Re: How to debug over-release of private Cocoa object?
Re: How to debug over-release of private Cocoa object?
- Subject: Re: How to debug over-release of private Cocoa object?
- From: Graham Cox <email@hidden>
- Date: Wed, 16 Sep 2009 12:40:11 +1000
Open Instruments, add the object allocation instrument, turn on
reference count recording and zombie detection in the instrument,
and then record your app. Do what you need to do to reproduce the
problem. When it triggers, you'll get a backtrace of both the
offending access and everything that retained or released the
object. If that takes too long, then have the instrument only
record NSUndoManager objects instead of everything.
Ok, I'm fumbling a bit with Instruments, but I think I got what I
wanted. I'm using the Object Alloc instrument, I tuned on zombies, and
I used 'configure' to set it to look for _NSUndo*
I triggered the bug and I get this in the events list for the zombied
object:
# Category Event Type RefCt Timestamp Address Size Responsible
Library Responsible Caller
0 _NSUndoBeginMark Malloc 1 02:30.345 0x17170ee0 32 Foundation -
[_NSUndoStack markBegin]
1 _NSUndoBeginMark Zombie -1 02:31.083 0x17170ee0 0 Foundation -
[_NSUndoStack _removeBottom]
What seems weird to me is that there is no release or dealloc event
for this. It jumps straight from ref count = 1 to being a zombie. How
is that possible? Or am I not using the tool correctly?
The stack trace for the creation of the object ties in with the bug
trigger - editing text, and that for the zombie message is the same as
for gdb. I will be combing that code in fine detail but I would like
to make some sense of the above first.
--Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden