Memory Leak

Discussion in 'iOS Programming' started by Ides, Aug 5, 2012.

  1. macrumors member

    Mar 27, 2012
    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?
  2. macrumors 68030


    Sep 2, 2008
    Is it a 48 byte leak from strdup?

    If not, post a screenshot of the leaks.
  3. macrumors regular

    Jun 26, 2011
  4. thread starter macrumors member

    Mar 27, 2012
    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.

Share This Page