Re: another n00b question -- how to find a memory leak
Re: another n00b question -- how to find a memory leak
- Subject: Re: another n00b question -- how to find a memory leak
- From: Bill Bumgarner <email@hidden>
- Date: Wed, 22 Oct 2008 13:37:26 -0700
On Oct 22, 2008, at 1:15 PM, John Zorko wrote:
I've found a few leaks in my app using Instruments, and it works
well, but i've this message that appears in the console window when
I run the app under XCode, and i'm not sure how to find the cause:
2008-10-22 13:06:57.998 Magnatune[1956:dc23] ***
_NSAutoreleaseNoPool(): Object 0x17d6f0 of class NSCFData
autoreleased with no pool in place - just leaking
Stack: (0x306d242b 0x3066f2c7 0x3066f293 0x3067d159 0x3067cfbf
0x3067cf9d 0x3e21 0x306abbd3 0x306714fd 0x306ea311 0x10a59
0x3486e530 0x347e6bac 0x34881920 0x30269cb9 0x30269367 0x3486c7d0
0x34870d38 0x34825880 0x3144a825)
... I think it might have something to do with my Core Audio code,
as this only happens once I start playing audio, but again, i'm not
sure how to use the information supplied in the message to determine
where the leak is in the code. Can anyone illuminate me?
One of two reasons, most likely:
(1) You have done something in main() before passing control to the
AppKit (NSApplicationMain()) and without creating an autorelease pool.
(2) You are doing something in a thread that does not have a runloop
and have not created an autorelease pool.
I'm betting (2). In particular, if you have a Core Audio callback
being triggered in a secondary thread and you are using Objective-C in
that callback, there may not be a pool in place.
Do this in your callback:
{
NSAutoreleasePool *p = [[NSAutoreleasePool alloc] init];
... do your callback thing here ...
[p drain];
return ... whatever you need to return ...;
b.bum
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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