Ok, so I saw that someone asked this question over 4 months ago. But it has been a decent time since Mojave has been out. Does anyone know how to get it working or possibly any alternatives so that I can check my programs for memory leaks. I am a student, so cost does matter but this is a requirement for several of my classes. I would prefer not to have to use a virtual machine considering they never run well on Macs. Any suggestions would be great. Thanks.
Due to changes on how macOS bundles and loads system dylibs, Valgrind is currently unable to track memory allocation correctly and thus to report memory leaks on macOS 11 and later.
Valgrind does not seem to work on M1 Macs. Issue #5 · LouisBrunner/homebrew-valgrind · GitHub.
You have few options here.
You can use XCode
for development and run the code in Profile
mode.
You can start Instruments
and attach to process
You can run the code and use leaks
to determine the leak size
> leaks 2419
Process: LeakingTheMemory [2419]
Path: /Users/USER/*/LeakingTheMemory
...
...
...
leaks Report Version: 4.0
Process 2419: 196 nodes malloced for 262162 KB
Process 2419: 26 leaks for 134217760 total leaked bytes.
26 (128M) << TOTAL >>
1 (64.0M) ROOT LEAK: 0x10b17c000 [67108864]
1 (32.0M) ROOT LEAK: 0x105726000 [33554432]
1 (16.0M) ROOT LEAK: 0x104726000 [16777216]
1 (8.00M) ROOT LEAK: 0x103f26000 [8388608]
1 (4.00M) ROOT LEAK: 0x103b26000 [4194304]
1 (2.00M) ROOT LEAK: 0x103926000 [2097152]
1 (1.00M) ROOT LEAK: 0x103826000 [1048576]
1 (512K) ROOT LEAK: 0x1037a6000 [524288]
1 (256K) ROOT LEAK: 0x103766000 [262144]
1 (128K) ROOT LEAK: 0x103746000 [131072]
1 (64.0K) ROOT LEAK: 0x103735000 [65536]
1 (32.0K) ROOT LEAK: 0x7fa354007800 [32768]
1 (16.0K) ROOT LEAK: 0x7fa354003800 [16384]
1 (8.00K) ROOT LEAK: 0x7fa354001800 [8192]
1 (4.00K) ROOT LEAK: 0x7fa354000800 [4096]
1 (2.00K) ROOT LEAK: 0x7fa354000000 [2048]
1 (1.00K) ROOT LEAK: 0x7fa353802000 [1024]
1 (512 bytes) ROOT LEAK: 0x7fa3535000a0 [512]
1 (256 bytes) ROOT LEAK: 0x7fa353402fa0 [256]
1 (128 bytes) ROOT LEAK: 0x7fa353500020 [128]
1 (64 bytes) ROOT LEAK: 0x7fa353600000 [64]
1 (32 bytes) ROOT LEAK: 0x7fa353402d40 [32]
1 (16 bytes) ROOT LEAK: 0x7fa353402eb0 [16]
1 (16 bytes) ROOT LEAK: 0x7fa353402ec0 [16]
1 (16 bytes) ROOT LEAK: 0x7fa353500000 [16]
1 (16 bytes) ROOT LEAK: 0x7fa353500010 [16]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With