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 13:17:34 +1000
On 16/09/2009, at 12:43 PM, Nick Zitzmann wrote:
On Sep 15, 2009, at 8:40 PM, Graham Cox wrote:
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?
Are you sure you have reference counting also turned on? If you
launched Instruments from within Xcode, you don't, since it's not
turned on by default since it generates a tremendous amount of data.
Ah, no I didn't.
Turning it on made it very hard to even allow my app to start -
repeatedly ran out of memory and just quit. (Incidentally, I see in
Snow Leopard that all such crashes get sent to Apple - there is no
'Cancel' button any more on the crash reports. Hope they are finding
this entertaining - especially as it's increasingly looking like their
bug ;-)
So, here's the lifetime of the object:
# Category Event Type RefCt Timestamp Address Size Responsible
Library Responsible Caller
0 _NSUndoBeginMark Malloc 1 01:48.335 0x1731f0f0 32 Foundation -
[_NSUndoStack markBegin]
1 _NSUndoBeginMark Release 0 01:48.416 0x1731f0f0 0 Foundation -
[_NSUndoStack _removeBottom]
2 _NSUndoBeginMark Zombie -1 01:53.707 0x1731f0f0 0 Foundation -
[_NSUndoStack _removeBottom]
So the over-release is in _removeBottom. The stack trace of the first
release is simply this:
0 CoreFoundation __CFDoExternRefOperation
1 CoreFoundation -[NSObject(NSObject) release]
2 Foundation -[_NSUndoStack _removeBottom]
3 Foundation -[_NSUndoStack markEnd]
4 Foundation -[NSUndoManager _endUndoGroupRemovingIfEmpty:]
5 Foundation -[NSUndoManager endUndoGrouping]
6 Foundation +[NSUndoManager(NSPrivate) _endTopLevelGroupings]
7 AppKit -[NSApplication run]
8 AppKit NSApplicationMain
9 Ortelius main /Users/graham/Projects/Ortelius/Trunk/Source/Code/
main.m:15
10 Ortelius start
The second (over) release is the same, but of course ends up
triggering the zombie instead.
Since nothing else touches this object isn't this a clear-cut case of
an over-release/stale reference in the undo manager? Or should I still
be looking for something suspect in my code? The odd thing is that all
my usual undoable things are working normally (all of which I'm
handling by calling the undo manager myself) with the exception of
text editing, which is about the only thing I'm NOT doing myself - I
just let NSTextView do it's built-in thing with respect to undo of
typing.
I guess it's time to strip this down to a small reproducible case I
can give them...
--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