OS X - Development and Darwin Discussion and questions about development for Mac OS X.

Memory leak/error tool for OS X?


Post Reply New Thread Subscribe

 
Thread Tools
miggles

 
Member Since: Aug 03, 2004
Posts: 39
miggles is on a distinguished road

miggles is offline
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.
QUOTE Thanks
witeshark

 
witeshark's Avatar
 
Member Since: Mar 09, 2004
Location: Miami FL
Posts: 2,860
witeshark will become famous soon enough
Mac Specs: G4 1Ghz OS X 10.4.7

witeshark is offline
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
QUOTE Thanks
miggles

 
Member Since: Aug 03, 2004
Posts: 39
miggles is on a distinguished road

miggles is offline
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;
}
QUOTE Thanks
witeshark

 
witeshark's Avatar
 
Member Since: Mar 09, 2004
Location: Miami FL
Posts: 2,860
witeshark will become famous soon enough
Mac Specs: G4 1Ghz OS X 10.4.7

witeshark is offline
miggles, application level leaks. Dude There's the difference!
QUOTE Thanks
dr_springfield
Guest
 
Posts: n/a

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.
QUOTE Thanks
miggles

 
Member Since: Aug 03, 2004
Posts: 39
miggles is on a distinguished road

miggles is offline
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.
QUOTE Thanks
dr_springfield
Guest
 
Posts: n/a

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.
QUOTE Thanks

Post Reply New Thread Subscribe


« Random Wallpaper | not understanding why it will not compile »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Powerbook 15" Aluminum Memory Upgrade JayJay Apple Notebooks 12 07-22-2004 12:24 PM
HELP! Memory upgrade nightmare Nobody Apple Notebooks 6 01-14-2004 02:33 PM
Looking for 512MB, SO-DIMM 3.3V memory shobhan Apple Desktops 1 12-27-2003 11:59 AM
Memory Mac Apple Apple Desktops 1 12-19-2003 08:45 AM
Trans Intl. offers 1GB iBook G4 memory modules Murlyn Apple Notebooks 0 11-12-2003 01:41 AM

All times are GMT -4. The time now is 02:23 PM.

Powered by vBulletin
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?