There are many, many questions and articles and discussions out there about tracking down memory leaks, and finding over-release bugs. Neither of those, AFAICT, is what's happening to me. If there's a good article or Fine Manual out there that I should read, I haven't found it.
In my iPhone app, I've got a modal table view controller that allows users to manage a collection of Core Data entities. The immediate symptom that I'm seeing is that you delete the last thing out of that collection, and when you dismiss the controller, the app crashes with EXC_BAD_ACCESS... but not in my code. Here's the concrete information I have: - The stack trace for the crash is as follows (which, of course, is enormously frustrating, because it isn't happening in my code): #0 0x91a27ed7 in objc_msgSend #1 0x04ba6b20 in ?? #2 0x01dc89ba in _performRunLoopAction #3 0x02240252 in __CFRunLoopDoObservers #4 0x0223f65f in CFRunLoopRunSpecific #5 0x0223ec48 in CFRunLoopRunInMode #6 0x0288b615 in GSEventRunModal #7 0x0288b6da in GSEventRun #8 0x004b1faf in UIApplicationMain #9 0x0000284a in main at main.m:14 - Examining $eax and $ecx (thanks, Greg Parker), the crash appears to be happening when something calls -retainCount on the deleted managed object instance. - I've enabled zombies, and turned on several of the malloc debugging flags. I've checked malloc_history, and the allocation of the object is exactly where I expect, and the deallocation seems to be in a reasonable place. (In particular, when the table view is autoreleased, releasing its cells, one of which was holding a reference to the entity.) The memory for the object IS being scribbled as expected. - Build & Analyze doesn't turn anything up. - I did some poking around with my limited GDB skills, and was able to determine that, at the time of the crash, the managed object context that had contained the instance was now empty. (As expected, given that the object was deallocated.) It seems like what's happening is that there's some object someplace that's holding an unretained pointer to my entity, and trying to use it after it's gone. But the stack trace doesn't tell me much of anything (and I confess that I really don't grok assembly). I'm hoping that maybe the trace will look familiar to someone on this list, or someone might be able to recommend a technique for tracking down what thing might have that pointer. I've found LOTS of advice for determining what code freed an object, but nothing about groping memory to find references to it. Sixten _______________________________________________ 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