After my main NSDocument algorithm method was done doing its thing and returned 
up the call chain to where the button click had started its action, it would 
flip to showing NSPopAutoreleasePool and I was crashing with EXC_BAD_ACCESS.  
So, I looked at all of my alloc, initWith..., retain, and releases.  I did find 
a couple things which I should have been releasing, but had not, but no obvious 
ones I had been releasing that I should not have been.

So, I looked in the archives and on the web and fired up some of the tools, one 
by one: MallocDebug, ObjectAlloc (and tried malloc_history with no luck at 
all).  I got these:

from NSLog and the run log/Debugger Console:
2010-09-13 21:11:40.899 DijkstraCocoa[411] MyDocument findRelationship:      
---display predecessors---
(gdb) continue
2010-09-13 21:11:46.345 DijkstraCocoa[411] displayResults: 
resultsField=<NSTableView: 0x549e50>
2010-09-13 21:11:46.346 DijkstraCocoa[411] displayResults: 
superView=<NSClipView: 0x549ca0>, superSuperView=<NSScrollView: 0x5499c0> 
window=<NSWindow: 0x54ca00>
(gdb) continue
2010-09-13 21:11:48.638 DijkstraCocoa[411] MyDocument findRelationship:  --- 
DONE ---
Program received signal:  "EXC_BAD_ACCESS".
(gdb)

0 objc_msgSend
1 NSPopAutoreleasePool
2 -[NSApplication run]
3 NSApplicationMain
4 main

0 objc_msgSend
0x908611e4  <+0004>  beq-       0x90861308 <objc_msgSend+296>
0x908611e8  <+0008>  lwz        r12,0(r3)
0x908611ec  <+0012>  lwz        r12,32(r12)
0x908611f0  <+0016>  stw        r9,48(r1)
0x908611f4  <+0020>  lwz        r11,0(r12)
0x908611f8  <+0024>  addi       r9,r12,8
0x908611fc  <+0028>  rlwinm     r11,r11,2,0,29
0x90861200  <+0032>  and        r12,r4,r11
0x90861204  <+0036>  lwzx       r2,r9,r12
0x90861208  <+0040>  addi       r12,r12,4
0x9086120c  <+0044>  cmplwi     r2,0
0x90861210  <+0048>  beq-       0x90861234 <objc_msgSend+84>

1 NSPopAutoreleasePool
0x90a21da8  <+0336>  beq+       cr7,0x90a21dbc <NSPopAutoreleasePool+356>
0x90a21dac  <+0340>  addis      r4,r31,4097
0x90a21db0  <+0344>  mr r3,r29
0x90a21db4  <+0348>  lwz        r4,-3720(r4)
0x90a21db8  <+0352>  bl 0x90b47aa8 <dyld_stub_objc_msgSend>
0x90a21dbc  <+0356>  lwz        r2,8(r30)
0x90a21dc0  <+0360>  addi       r27,r27,1
0x90a21dc4  <+0364>  cmplw      cr7,r28,r2
0x90a21dc8  <+0368>  blt+       cr7,0x90a21d64 <NSPopAutoreleasePool+268>

2 -[NSApplication run]
0x9730407c  <+0592>  bl 0x976f8028 <dyld_stub_objc_msgSend>
0x97304080  <+0596>  lwz        r3,864(r1)
0x97304084  <+0600>  addis      r4,r31,4095
0x97304088  <+0604>  lwz        r4,6316(r4)
0x9730408c  <+0608>  bl 0x976f8028 <dyld_stub_objc_msgSend>
0x97304090  <+0612>  lwz        r2,1320(r1)
0x97304094  <+0616>  lha        r0,50(r2)
0x97304098  <+0620>  cmpwi      cr7,r0,0
0x9730409c  <+0624>  bne+       cr7,0x97303fe4 <-[NSApplication run]+440>
0x973040a0  <+0628>  addi       r3,r1,80
0x973040a4  <+0632>  bl 0x976f8208 <dyld_stub__NSRemoveHandler2>
0x973040a8  <+0636>  b  0x97304130 <-[NSApplication run]+772>

3 NSApplicationMain
0x973c0750  <+0444>  bl 0x976fbb68 <dyld_stub_ptrace>
0x973c0754  <+0448>  lwz        r3,0(r30)
0x973c0758  <+0452>  addis      r4,r31,4083
0x973c075c  <+0456>  lwz        r4,24824(r4)
0x973c0760  <+0460>  bl 0x976f8028 <dyld_stub_objc_msgSend>
0x973c0764  <+0464>  li r3,0
0x973c0768  <+0468>  ori        r3,r3,41471
0x973c076c  <+0472>  li r4,0
0x973c0770  <+0476>  li r5,0
0x973c0774  <+0480>  li r6,0
0x973c0778  <+0484>  bl 0x976fbb68 <dyld_stub_ptrace>

4 main
#import <Cocoa/Cocoa.h>

int main(int argc, char *argv[])
{
    return NSApplicationMain(argc, (const char **) argv);
}


MallocDebug says:
/Users/giovanni/Projects/DijkstraCocoa/build/DijkstraCocoa.app/Contents/MacOS/DijkstraCocoa
 accessed memory at 0x55555575 illegally. It probably tried to dereference a 
pointer in freed memory.

The most interesting thing ObjAlloc were some tiny objects containing only an 
unsigned long long, which I allocate to stuff in a set, the sole purpose of 
which is as a quick test for the status of a node of my graph (not yet 
examined, examined and now in the priority queue, visited and removed from the 
priority queue).  (Come to think of it, there may be a better way.)  Anyway, it 
was the only kind of object that jumped out at me has having any irregularity, 
so I looked at them quite closely, before NSZombies told me it was worried 
about an enumerator.

NSZombies says:
2010-09-13 22:47:33.575 DijkstraCocoa[511] *** *** Selector 'release' sent to 
dealloced instance 0x593180 of class NSIdEnumerator.
Break at '-[_NSZombie release]' to debug.
2010-09-13 22:47:33.575 DijkstraCocoa[511] *** -[NSAutoreleasePool dealloc]: 
Exception ignored while releasing an object in an autorelease pool: 
NSGenericException *** Selector 'release' sent to dealloced instance 0x593180 
of class NSIdEnumerator.
Break at '-[_NSZombie release]' to debug.

0x90adb928  <+0000>  mr r5,r3
0x90adb92c  <+0004>  mr r3,r4
0x90adb930  <+0008>  b  0x90adb580 <logMessageAndRaise>

0 -[_NSZombie release]
1 NSPopAutoreleasePool
2 _NSAppleEventManagerGenericHandler
3 aeDispatchAppleEvent(AEDesc const*, A...
4 dispatchEventAndSendReply(AEDesc cor...
5 aeProcessAppleEvent
6 AEProcessAppleEvent
7 _DPSNextEvent
8 -[NSApplication nextEventMatchingMask:untilDate:i...
9 -[NSApplication run]
10 NSApplicationMain
11 main

0 -[_NSZombie release]
1 NSPopAutoreleasePool
2 -[NSApplication run]
3 NSApplicationMain
4 main

What I'm wondering is how do I go about tracking down which enumerator is 
causing the problems?  I'm not explicitly using autorelease pools of my own.


      
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to