View Full Version : Memory Leak
Aug 5, 2012, 08:54 PM
Hi, I have an app that has a memory leak that I can't seem to get rid of (I don't even know what's causing it). Instruments reports leaks of many objects, but where it normally says the name of the class the object belongs to, that field is blank. So I don't know what kind of object is being leaked. Furthermore, instruments says the responsible library is Foundation, and the responsible frame is NSAutoreleasePool. What does this mean?
Aug 5, 2012, 10:42 PM
Is it a 48 byte leak from strdup?
If not, post a screenshot of the leaks.
Aug 5, 2012, 10:50 PM
Does this happen inside a scrollview?
There is currently a leak in iOS5 involving strdup.
Check this Apple Developer Forum: https://devforums.apple.com/thread/144449?start=0&tstart=0(Requires Login)
Aug 6, 2012, 12:30 PM
Thanks for the replies everyone, but I found the problem! :) I had a method being called on a background thread and at the beginning of the method I created an autorelease pool, and drained it at the end of the method, just like you're supposed to do when running on different threads. However, I forgot to take into account that there are several places in which my method might "return". I simply added [pool drain]; right before each return statement I had and the problem was solved.