Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak on macOS #18

Open
kamidev opened this issue Apr 9, 2024 · 2 comments
Open

Memory leak on macOS #18

kamidev opened this issue Apr 9, 2024 · 2 comments

Comments

@kamidev
Copy link
Contributor

kamidev commented Apr 9, 2024

Tested with download binary for zig version nominated by Mach.

➜  aftersun git:(main) which mzig
mzig: aliased to /Users/jonas/src/zig/zig-macos-aarch64-0.12.0-dev.3180+83e578a18/zig
➜  aftersun git:(main) sw_vers; mzig cc -v
ProductName:		macOS
ProductVersion:		14.4.1
BuildVersion:		23E224
clang version 17.0.6 (https://github.com/ziglang/zig-bootstrap 4c78aa1bba84dbd324e178932cd52221417f63da)
Target: aarch64-unknown-darwin23.4.0
Thread model: posix
InstalledDir: /usr/bin

Run app (using sysgpu) and immediately close it.
Expected result is diagnostic output withour errors.

➜  aftersun git:(main) mzig build run -Duse_sysgpu=true
info(mach): found Metal backend on Discrete GPU adapter: Apple M3 Max,

error(gpa): memory address 0x11571c000 leaked:
/Users/jonas/.cache/zig/p/1220ba5472217ef81455b19d540967049bbfaf768b30d04534865707e907ee1c4aec/src/sysgpu/metal.zig:2136:43: 0x105a1e487 in init (aftersun)
        const queue = try allocator.create(Queue);
                                          ^
/Users/jonas/.cache/zig/p/1220ba5472217ef81455b19d540967049bbfaf768b30d04534865707e907ee1c4aec/src/sysgpu/metal.zig:278:42: 0x105a1e793 in getQueue (aftersun)
            device.queue = try Queue.init(device);
                                         ^
/Users/jonas/.cache/zig/p/1220ba5472217ef81455b19d540967049bbfaf768b30d04534865707e907ee1c4aec/src/sysgpu/main.zig:599:38: 0x105a211ef in init (aftersun)
        const queue = device.getQueue() catch @panic("api error");
                                     ^
/Users/jonas/.cache/zig/p/1220ba5472217ef81455b19d540967049bbfaf768b30d04534865707e907ee1c4aec/src/core/main.zig:151:27: 0x105a23ecf in init (aftersun)
    try platform.Core.init(
                          ^
/Users/jonas/src/zig/aftersun/src/aftersun.zig:157:18: 0x105a8047b in init (aftersun)
    try core.init(.{
                 ^
/Users/jonas/.cache/zig/p/1220ba5472217ef81455b19d540967049bbfaf768b30d04534865707e907ee1c4aec/src/core/platform/native_entrypoint.zig:36:17: 0x105a8da1f in main (aftersun)
    try app.init();
                ^
@kamidev
Copy link
Contributor Author

kamidev commented Apr 9, 2024

I don’t know if this is significant. But when I use a local build of zig master, "zig cc -v" shows a more specific target.

➜  zig git:(master) zig cc -v
Homebrew clang version 17.0.6
Target: arm64-apple-darwin23.4.0
Thread model: posix
InstalledDir: /usr/bin

@foxnne
Copy link
Owner

foxnne commented Apr 10, 2024

Thanks for the issue! Hopefully soon I can track down why the queue isn't freeing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants