Memory Leak

Discussion in 'iPhone/iPad Programming' started by Ides, Aug 5, 2012.

  1. macrumors member

    Joined:
    Mar 27, 2012
    #1
    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

    PhoneyDeveloper

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

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

    Joined:
    Jun 26, 2011
    Location:
    Florida
    #3
  4. thread starter macrumors member

    Joined:
    Mar 27, 2012
    #4
    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