Post Reply 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Testing for memory leaks?
Nethfel Offline

Posts: 2
Joined: Mar 2010
Post: #1
Testing for memory leaks?
Hi all,

I'm very new to programming on OSX and programming with Obj-C - I was wondering if there is a way to monitor memory allocation and deallocation when running small test programs.

For example - let's say I make a class and make a small program to test the class (one that will test the methods via sending fixed data and just output via NSLog) so basically there would only be maybe a couple dozen lines in main to test the methods and sending various arguments to the methods and it would be quick in/out of the program.

So is there a tool to watch allocation and deallocation of memory? I tried shark, but it complains because the program exits near instantaneously after outputting a few lines (which is normal) and I don't see a way in GDB to track allocation and deallocation of memory (possibly because I don't fully know how to use GDB yet) - especially if it's a pointer that's been shifted from one memory location to another without releasing the first location...

Suggestions welcome!
2010.07.07 03:09 PM
Find all posts by this user Quote this message in a reply
szymczyk Offline
Junior Member

Posts: 28
Joined: Jan 2006
Post: #2
Testing for memory leaks?
Take a look at Instruments. The Leaks and Object Allocations templates would be the ones that would help you most. I'm not sure how great Instruments is with small programs, but it's the best tool for monitoring memory allocations on Mac OS X.
2010.07.21 02:43 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply 

User(s) browsing this thread: 1 Guest(s)