zig-gamedev: zgpu: Memory leak in samples (Dawn leaks ~20KB per frame on macOS)
It seems like all the samples have are leaking memory. One can detect this by observing the memory usage of the sample goes up over time.
zig version: 0.10.0-dev.4249+11dce7894
$ zig build triangle_wgpu-run
info: [zgpu] High-performance device has been selected:
info: [zgpu] Name: Apple M1
info: [zgpu] Driver: Metal driver on macOS Version 12.6 (Build 21G115)
info: [zgpu] Adapter type: discrete_gpu
info: [zgpu] Backend type: meta
Here is a capture of the triangle sample’s memory usage captured once per second:
48 michal-z/zig-gamedev/zig-out/bin/triangle_wgpu
95216 michal-z/zig-gamedev/zig-out/bin/triangle_wgpu
96368 michal-z/zig-gamedev/zig-out/bin/triangle_wgpu
97424 michal-z/zig-gamedev/zig-out/bin/triangle_wgpu
98512 michal-z/zig-gamedev/zig-out/bin/triangle_wgpu
99504 michal-z/zig-gamedev/zig-out/bin/triangle_wgpu
100528 michal-z/zig-gamedev/zig-out/bin/triangle_wgpu
101552 michal-z/zig-gamedev/zig-out/bin/triangle_wgpu
102544 michal-z/zig-gamedev/zig-out/bin/triangle_wgpu
103584 michal-z/zig-gamedev/zig-out/bin/triangle_wgpu
104576 michal-z/zig-gamedev/zig-out/bin/triangle_wgpu
105584 michal-z/zig-gamedev/zig-out/bin/triangle_wgpu
106656 michal-z/zig-gamedev/zig-out/bin/triangle_wgpu
107696 michal-z/zig-gamedev/zig-out/bin/triangle_wgpu
108720 michal-z/zig-gamedev/zig-out/bin/triangle_wgpu
109712 michal-z/zig-gamedev/zig-out/bin/triangle_wgpu
110800 michal-z/zig-gamedev/zig-out/bin/triangle_wgpu
In Activity Monitor memory usage seems to go up by 40 megabytes per second.
I commented out zgui and the leak remains.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 27 (12 by maintainers)
Just to let you know, I’m still working on Dawn update, some changes in
zgpuare needed so it may takes few more days.@Pyrolistical @meshula We now have new binaries and @foxnne doesn’t see memory leak on macOS anymore. I highly recommend to upgrade.
That’s a good news! We need to re-compile and update our Dawn binaries for all platforms. I’m planning to do it in coming weeks.
Thanks. I found it in the issue tracker https://bugs.chromium.org/p/dawn/issues/detail?id=1175
Which discord held this discussion? Dawn doesn’t have a discord
Thanks! We’ll upgrade as soon as possible.
I think it would make sense to do so after zgpu is updated to latest. Otherwise I am only one data point, and I would be happy to discover that after the zgpu update the problem has been resolved.
Yeah, I need to do it. Sorry for the delay. Will try early next week.
This is a bug in Dawn and it affects only macOS. This should be fixed after we update to newer Dawn versions. There was a discussion about this bug on Discord.