PDA

View Full Version : Why GuardMalloc doesn't report memory leak?




mikezang
Aug 21, 2010, 06:06 AM
Here is my dealloc in my view controller, even if I comment some release, GuardMalloc doesn't report any memory leak, why?

- (void)dealloc {
[popoverController release];
[toolbar release];

[detailItem release];
//[detailDescriptionLabel release];
[super dealloc];
}



Cromulent
Aug 21, 2010, 07:06 AM
Because GuardMalloc is not a tool to find memory leaks. It is a tool that (for instance) crashes when you try and read data from a previously freed block of memory rather than simply reading arbitrary data from the memory address. It also can be used to determine if you are writing past the end of an allocated block of memory. It will also help identify double frees etc.

Use things like the static analyser and Instruments to help find memory leaks.

Edit: Look here:

http://developer.apple.com/iphone/library/documentation/Performance/Conceptual/ManagingMemory/Articles/FindingLeaks.html#//apple_ref/doc/uid/20001883-CJBJFIDD

mikezang
Aug 21, 2010, 07:15 AM
Thanks for your easier explanation.