Re: How to debug this error on closing a document?
Re: How to debug this error on closing a document?
- Subject: Re: How to debug this error on closing a document?
- From: Gideon King <email@hidden>
- Date: Thu, 11 Mar 2010 20:27:46 +1000
Well I spent some of the day going through the application with the analyzer - first time I have used it, and I'm pretty impressed - I like the way it draws the lines showing the relevant lines of code...but although it did pick up some leaks etc, it made no difference to my specific problem.
When I run with zombies enabled outside instruments, it just gets to
*** -[NSManagedObjectContext release]: message sent to deallocated instance 0x100e99710
(where I have set a breakpoint) with a backtrace of:
#0 0x00007fff80e5be36 in ___forwarding___ ()
#1 0x00007fff80e581d8 in __forwarding_prep_0___ ()
#2 0x00007fff856fb99e in -[NSConcreteNotification dealloc] ()
#3 0x00007fff80e06e43 in __CFArrayReleaseValues ()
#4 0x00007fff80de7bc8 in _CFArrayReplaceValues ()
#5 0x00007fff8573081a in postQueueNotifications ()
#6 0x00007fff80e49427 in __CFRunLoopDoObservers ()
#7 0x00007fff80e254af in __CFRunLoopRun ()
#8 0x00007fff80e24c2f in CFRunLoopRunSpecific ()
#9 0x00007fff831b9a4e in RunCurrentEventLoopInMode ()
#10 0x00007fff831b9853 in ReceiveNextEventCommon ()
#11 0x00007fff831b970c in BlockUntilNextEventMatchingListInMode ()
#12 0x00007fff860f51f2 in _DPSNextEvent ()
#13 0x00007fff860f4b41 in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] ()
#14 0x00007fff860ba747 in -[NSApplication run] ()
#15 0x0000000100331774 in -[OAApplication run] ()
#16 0x00007fff860b3468 in NSApplicationMain ()
#17 0x0000000100001af3 in main (argc=3, argv=0x7fff5fbff478) at /Users/gideon/Development/svn/trunk/mac/Source/main.m:11
...and if I continue from there, it just gets a sigkill and dies.
So I'm unsure what I can do with this backtrace to find out what this notification is, or whether I would have to subclass NSConcreteNotification and override dealloc and then use pose as, so I could print out the notification name etc, to get the info...is there a simpler way of seeing what the notification is?
But even if I do find that, I'm really not sure that it would be much help because presumably it means that some notification was sent with the managed object context as the object, in which case it would just be retained and then released when the notification is released, so presumably whatever the notification is, it's not the root cause of the problem - just something that delays the visibility of the issue. Correct?
I still don't quite understand how there can only be two events on this object as per the instruments output:
# Category Event Type RefCt Timestamp Address Size Responsible Library Responsible Caller
0 NSManagedObjectContext Malloc 1 00:12.552 0x1008d01f0 240 AppKit -[NSPersistentDocument managedObjectContext]
1 NSManagedObjectContext Zombie -1 00:26.194 0x1008d01f0 0 Foundation -[NSConcreteNotification dealloc]
And yet it ends up a zombie.
Still totally mystified by this and looking for suggestions on how to track it down.
Thanks in advance.
Gideon
On 11/03/2010, at 11:05 AM, Kyle Sluder wrote:
> On Wed, Mar 10, 2010 at 4:45 PM, Gideon King <email@hidden> wrote:
>> Seeing as none of this appears to have anything to do with my code, I am assuming that some notification created somewhere in my application is somehow the cause, but I'm not sure how to track this down.
>
> Run the analyzer first, then if that doesn't turn up any problems use
> NSZombieEnabled outside of Instruments.
>
> --Kyle Sluder
_______________________________________________
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