finding memory leaks
finding memory leaks
- Subject: finding memory leaks
- From: Torsten Curdt <email@hidden>
- Date: Mon, 11 Feb 2008 15:25:33 +0100
...surely a FAQ but I am a bit struggling with it over this code
http://nopaste.ch/1685f5d17a92cfd.html
For this snippet there is nothing that should live on after the
blocks has finished. So no "retain" and things should be quite
straight forward. With the NSAutoreleasePool I just find it hard to
find out what needs to the "autorelease"'d and what not. ("alloc",
"new" etc are already covered - I know) But somehow I am still
failing according to "leaks".
Call stack: [thread 1dad]: | 0x1 | start | _start | main |
NSApplicationMain | -[NSApplication run] | -[NSApplication
sendEvent:] | -[NSWindow sendEvent:] | -[NSTextView keyDown:] | -
[NSView interpretKeyEvents:] | -[NSTSMInputContext
interpretKeyEvents:] | -[NSKeyBindingManager
(NSKeyBindingManager_MultiClients) flushTextForClient:] | -
[NSTextView insertText:] | -[NSTextView(NSSharing) didChangeText] | -
[NSNotificationCenter postNotificationName:object:userInfo:] |
_CFXNotificationPostNotification | __CFXNotificationPost |
_nsnote_callback | -[NSTextField textDidChange:] | -
[NSNotificationCenter postNotificationName:object:userInfo:] |
_CFXNotificationPostNotification | __CFXNotificationPost |
_nsnote_callback | -[MyDocument controlTextDidChange:] |
CFArrayAppendValue | _CFArrayReplaceValues | malloc_zone_malloc
Leak: 0x003c9780 size=32 string ' '
Call stack: [thread 1]: | 0x1 | start | _start | main |
NSApplicationMain | -[NSApplication run] | -[NSApplication
sendEvent:] | -[NSWindow sendEvent:] | -[NSTextView keyDown:] | -
[NSView interpretKeyEvents:] | -[NSTSMInputContext
interpretKeyEvents:] | -[NSKeyBindingManager
(NSKeyBindingManager_MultiClients) flushTextForClient:] | -
[NSTextView insertText:] | -[NSTextView(NSSharing) didChangeText] | -
[NSNotificationCenter postNotificationName:object:userInfo:] |
_CFXNotificationPostNotification | __CFXNotificationPost |
_nsnote_callback | -[NSTextField textDidChange:] | -
[NSNotificationCenter postNotificationName:object:userInfo:] |
_CFXNotificationPostNotification | __CFXNotificationPost |
_nsnote_callback | -[MyDocument controlTextDidChange:] | -
[NSPlaceholderMutableArray init] | -[NSPlaceholderMutableArray
initWithCapacity:] | __CFArrayInit | _CFRuntimeCreateInstance |
malloc_zone_malloc
Leak: 0x003a6760 size=16 string '@/0'
Call stack: [thread 1]: | 0x1 | start | _start | main |
NSApplicationMain | -[NSApplication run] | -[NSApplication
sendEvent:] | -[NSWindow sendEvent:] | -[NSTextView keyDown:] | -
[NSView interpretKeyEvents:] | -[NSTSMInputContext
interpretKeyEvents:] | -[NSKeyBindingManager
(NSKeyBindingManager_MultiClients) flushTextForClient:] | -
[NSTextView insertText:] | -[NSTextView(NSSharing) didChangeText] | -
[NSNotificationCenter postNotificationName:object:userInfo:] |
_CFXNotificationPostNotification | __CFXNotificationPost |
_nsnote_callback | -[NSTextField textDidChange:] | -
[NSNotificationCenter postNotificationName:object:userInfo:] |
_CFXNotificationPostNotification | __CFXNotificationPost |
_nsnote_callback | -[MyDocument controlTextDidChange:] | -
[NSPlaceholderMutableArray init] | -[NSPlaceholderMutableArray
initWithCapacity:] | __CFArrayInit | _CFRuntimeCreateInstance |
malloc_zone_malloc
Leak: 0x003a5e50 size=16 instance of 'ABSearchElementConjunction'
0xa47d2f20 0x00000001 0x003c9140 0x00000000 /}.....@.<.....
I need some help here to interpret this output. I have absolutely no
clue where the leaking strings are coming from. First though
"stringByTrimmingCharactersInSet" (line 14) but that does not like to
be autorelease'd. And for the ABSearchElementConjunction that looks
like searchElementForConjunction:children (line 47) needs an
autorelease. But when I do add it - the app crashes.
Any help appreciated.
cheers
--
Torsten_______________________________________________
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