Skip navigation.
 
mlRe: Autoreleasepool problems
FROM : Shawn Erickson
DATE : Wed Jul 19 20:11:50 2006

On 7/19/06, Kay Roepke <<email_removed>> wrote:
> Hi *!
>
> I'm totally stumped here. I have a parser framework and simple shell
> tool which uses the framework to parse some sample input text for
> testing.
> What happens is this:
> In main() I create an autorelease pool and call my parser. After
> lexing & parsing the input correctly, I release the pool as the last
> thing in main().
> The release fails (this is with NSDebugEnabled=YES,
> NSAutoreleaseFreedObjectCheckEnabled=YES):
> LL-star[4339] *** _NSAutoreleaseFreedObject(): release of previously
> deallocated object (0x30c7d0) ignored
>
> At this point there should only by NSCF* objects in the pool. But in
> addition there are two entries of my own object there, which I
> positively have notautoreleased myself. I do not call autorelease
> anywhere in my code.


If you call any code from the Cocoa framework (etc.) code in the
framework may send a retain following at some point by a release or
autorelease. In other words even you don't send an object an
autorelease some framework code may send it an autorelease message.

I think you are attacking the issue in the wrong way... don't attempt
to peer into autorelease pools or retain counts because you have poor
visibility of what framework code does.

Instead try to understand exactly which object is being over released
and look at that objects life time in code and by using things like
ObjectAlloc.app. Make sure to enable NSZombie support as well.

Also recall that the same address in memory can be reused so if you
have a stale pointer (which easily happens if you over release
something) then the pointer can end up pointer at an unrelated
object... which can confuse you attempts to debug things (NSZombie can
help with that).

-Shawn

Related mailsAuthorDate
mlAutoreleasepool problems Kay Roepke Jul 19, 19:54
mlRe: Autoreleasepool problems Shawn Erickson Jul 19, 20:11
mlRe: Autoreleasepool problems Kay Roepke Jul 19, 20:28
mlRe: Re: Autoreleasepool problems Shawn Erickson Jul 19, 20:41
mlRe: Autoreleasepool problems Kay Roepke Jul 19, 21:16
mlRe: Autoreleasepool problems Jerry Krinock Jul 19, 21:39
mlRe: Autoreleasepool problems Kay Roepke Jul 19, 22:02
mlNew debugging feature request? Was: Autoreleasepool problems Scott Ribe Jul 20, 18:34