Valgrind on Mac

Discussion in 'Mac Programming' started by DenBeke, Jan 4, 2013.

  1. macrumors regular

    Joined:
    Aug 11, 2011
    Location:
    Antwerp
    #1
    Are there any alternatives to Valgrind for finding memory leaks? (or precompiled binaries?)

    I don't seem smart enough to install it here, and I don't find any good alternative.

    Instruments, that comes with Xcode, isn't helping me neither. It keeps saying there are 'living bytes', although Valgrind (on Linux) says everything is ok.
     
  2. macrumors 68040

    Joined:
    Feb 2, 2008
    #2
    Instruments would be fine. Living bytes does not necessarily mean you have a leak, it's the total amount of memory in use at current time.
     
  3. thread starter macrumors regular

    Joined:
    Aug 11, 2011
    Location:
    Antwerp
    #3
    Well, maybe I'm just totally wrong,
    but I made a simple Linked List (C++).

    In that list I add 8 items, which uses dynamic memory. Thus overall number of allocations will be 8. The destructors runs through all items and deletes it. So at the end, there should be 0 living. Instruments says 1.

    [​IMG]
     
  4. macrumors G5

    gnasher729

    Joined:
    Nov 25, 2005
    #4
    1. The C++ runtime system doesn't always do what you think it does.
    2. We have no idea what your linked list code does. It may delete the items or it may not.
     
  5. thread starter macrumors regular

    Joined:
    Aug 11, 2011
    Location:
    Antwerp
    #5
  6. thread starter macrumors regular

    Joined:
    Aug 11, 2011
    Location:
    Antwerp
    #6
    Nobody who knows an alternative to Valgrind?
     
  7. macrumors 68040

    Joined:
    Feb 2, 2008
    #7
    Yes. :rolleyes:
     

Share This Page