5

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.

  • 1
    You could consider using Sanitizers, such as Address Sanitizer. Here is a link for Clang: https://clang.llvm.org/docs/AddressSanitizer.html. – Stanislav Pankevich Feb 07 '19 at 14:55
  • The support for that states "OS X 10.7 - 10.11 (i386/x86_64)". I am on 10.14.2 which is a dramatic difference since how the OS handles the filesystem and much more. – Tanner Breckenridge Feb 07 '19 at 15:00

1 Answers1

2

You have few options here.

  1. You can use XCode for development and run the code in Profile mode.

  2. You can start Instruments and attach to process

  3. 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]
  1. You can use Malloc Debugging Features
Oo.oO
  • 12,464
  • 3
  • 23
  • 45