Results 1 to 7 of 7
  1. #1


    Member Since
    Aug 03, 2004
    Posts
    39
    Memory leak/error tool for OS X?
    I use Rational Purify all the time at work, but it's only available for SunOS, Irix, redhat, and windows. Can anyone recommend a similar tool for OS X? I have seen a code called OmniObjectMeter, but it looks like it can only handle full-fledged applications which have been linked through Project Builder, not simple command line linked applications (e.g. an a.out which links in nothing and prints "hello world" to the terminal).

    Also, I have a long standing problem with debug-compiled (-g) objects which essentially makes gdb inconvenient and useless. Whenever I enter gdb, I always have to provide it the directories where the original source code objects are located. This is not trivial when I am linking in several dozen libraries or building different variants of codes under different source trees. Is there a way for gcc to encode the full paths into the objects to make gdb less cumbersome?

    Thanks.

  2. #2

    witeshark's Avatar
    Member Since
    Mar 09, 2004
    Location
    Miami FL
    Posts
    2,860
    Specs:
    G4 1Ghz OS X 10.4.7
    Memory leaks issues are one of the very best strong points of OS X: there are none that I have ever heard of and it's why the force quit app can safely stop a locked or looping app without affecting the rest of the system

  3. #3


    Member Since
    Aug 03, 2004
    Posts
    39
    I'm not so concerned about system level memory leaks as opposed to application level leaks. Imagine calling a C++ method that does nothing but allocate space, use it locally, but never delete it. Even though the system is safe from being harmed by this, the application may eventually kill itself when space runs out.


    void Blort()
    {
    int *a = new int [10000];
    a[0] = 5;
    }

    int main()
    {
    while (1)
    Blort();
    return 0;
    }

  4. #4

    witeshark's Avatar
    Member Since
    Mar 09, 2004
    Location
    Miami FL
    Posts
    2,860
    Specs:
    G4 1Ghz OS X 10.4.7
    miggles, application level leaks. Dude There's the difference!

  5. #5
    dr_springfield
    Guest
    leaks
    http://developer.apple.com/documenta...l/leaks.1.html

    But I've never used it. I typically use the memory management tools that come with Xcode. In one of the menus (not on a mac right now so I cant say exactly)... Debug probably, you'll see "Run with..." and there are several apps in there. The one that has the icon that looks like a melting icecube is my favorite. Wish I could tell you the name, but my brain is goo.

  6. #6


    Member Since
    Aug 03, 2004
    Posts
    39
    Thanks for the pointer dr_springfield. Unfortunately, that doesn't seem able to work with plain vanilla g++ compiled code either:

    % leaks ./a.out
    leaks cannot find a process you have access to which has a name like './a.out'


    Also, is there anything to trap memory errors such as UMRs (uninitialized memory reads) or FMRs (freed memory reads) as they happen? I'm interested in something that doesn't require the target application to link in the Carbon lib because I am working with codes that compile on multiple architectures (mainly different flavors of Unix). Thanks.

  7. #7
    dr_springfield
    Guest
    Quote Originally Posted by miggles
    Thanks for the pointer dr_springfield. Unfortunately, that doesn't seem able to work with plain vanilla g++ compiled code either:

    % leaks ./a.out
    leaks cannot find a process you have access to which has a name like './a.out'
    Just tested this out.
    Leaks only works on running executables. It's irritating, but you can just make your code wait for input when you want to check for memory leaks, and then run the command then.
    Also check out the "heap" and "malloc_history" commands.
    Quote Originally Posted by miggles
    Also, is there anything to trap memory errors such as UMRs (uninitialized memory reads) or FMRs (freed memory reads) as they happen? I'm interested in something that doesn't require the target application to link in the Carbon lib because I am working with codes that compile on multiple architectures (mainly different flavors of Unix). Thanks.
    gdb should handle this, shouldn't it? I'm not particularly good with gdb... I just sort of use it to do exactly what I have to do and don't know the entire massive extent of it's capabilities, but it seems like you could get that sort of info from gdb.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Memory Leak help
    By f00d4tehg0dz in forum OS X - Operating System
    Replies: 3
    Last Post: 12-08-2014, 02:48 PM
  2. Memory leak
    By manga in forum iOS Development
    Replies: 0
    Last Post: 05-16-2013, 07:21 AM
  3. Possible memory leak?... help
    By Mac_newusr in forum OS X - Development and Darwin
    Replies: 2
    Last Post: 08-10-2011, 04:13 PM
  4. Memory leak?
    By kgeier82 in forum OS X - Operating System
    Replies: 0
    Last Post: 05-10-2008, 02:09 PM
  5. Memory leak?
    By Furias in forum Apple Notebooks
    Replies: 1
    Last Post: 04-27-2006, 06:55 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •