问题
I'm running Xcode 4.4.1 and building an iOS app. My app is crashing and has a memory issue (I know because it is crashing on objc_msgSend
).
So I am running the Zombies Instruments tool. The problem is, it runs without error and no help about my zombies:
If I turn off Zombie detection then the program crashes predictably. Am I using the Zombie tool incorrectly? Or does this indicate I have a different problem?
useless stack trace follows...
#0 0x0212a09b in objc_msgSend ()
#1 0x01bd36b7 in -[NSError dealloc] ()
#2 0x0212ae3d in _objc_rootRelease ()
#3 0x01bc1f28 in -[NSFilesystemItemRemoveOperation dealloc] ()
#4 0x01bb0e16 in -[NSOperation release] ()
#5 0x0212ae00 in objc_release ()
#6 0x0212bc50 in (anonymous namespace)::AutoreleasePoolPage::pop(void*) ()
#7 0x004faea8 in _CFAutoreleasePoolPop ()
#8 0x004fd80b in __CFRunLoopRun ()
#9 0x004fcd84 in CFRunLoopRunSpecific ()
#10 0x004fcc9b in CFRunLoopRunInMode ()
#11 0x02ca57d8 in GSEventRunModal ()
#12 0x02ca588a in GSEventRun ()
#13 0x0127a626 in UIApplicationMain ()
#14 0x00002e5d in main at /Users/willentriken/Developer/EnglishStudy/EnglishStudy/main.m:16
#15 0x00002dc5 in start ()
回答1:
There's a bug in iOS before 6.0 (and Mac OS before 10.8) under ARC and NSZombieEnabled that prevents automatic release of instance variables and properties.
That explains what you see, because objects would just leak instead of turning into Zombies.
Solution: Test under iOS 6.0.
Additional info: The problem persists under Mountain Lion when testing in the 5.1 simulator.
来源:https://stackoverflow.com/questions/12132325/xcode-instrument-allocations-instrument-not-finding-zombies