【发布时间】:2009-08-06 09:18:32
【问题描述】:
以下是在 ~/.gdbinit 中放置的断点列表,它们对调试内存问题非常有帮助:
fb -[NSException raise]
fb -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:]
fb -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:]
#define NSZombies
# this will give you help messages. Set to NO to turn them off.
set env MallocHelp=YES
# might also be set in launch arguments.
set env NSZombieEnabled=YES
set env NSDeallocateZombies=NO
set env MallocCheckHeapEach=100000
set env MallocCheckHeapStart=100000
set env MallocScribble=YES
set env MallocGuardEdges=YES
set env MallocCheckHeapAbort=1
set env CFZombie 5
fb -[_NSZombie init]
fb -[_NSZombie retainCount]
fb -[_NSZombie retain]
fb -[_NSZombie release]
fb -[_NSZombie autorelease]
fb -[_NSZombie methodSignatureForSelector:]
fb -[_NSZombie respondsToSelector:]
fb -[_NSZombie forwardInvocation:]
fb -[_NSZombie class]
fb -[_NSZombie dealloc]
fb szone_error
【问题讨论】:
-
这些可能确实有帮助,但是其中有一个问题吗? SO 不是发布有用提示的 wiki — 那些属于 cocoadev.com,至少对于 Objective-C 和 Cocoa 而言。
-
@Quinn:可以,但根据常见问题解答,它应该作为一个问题发布,然后您可以自己回答;)
标签: objective-c iphone xcode memory-management gdb