Re: Does [NSApp setApplicationIconImage] leak memory?
Re: Does [NSApp setApplicationIconImage] leak memory?
- Subject: Re: Does [NSApp setApplicationIconImage] leak memory?
- From: Matt Neuburg <email@hidden>
- Date: Fri, 08 Aug 2008 06:02:47 -0700
- Thread-topic: Does [NSApp setApplicationIconImage] leak memory?
On Thu, 7 Aug 2008 20:14:04 +0100, Mark Allan <email@hidden>
said:
>Hi all,
>
>Before I file a bug report against this, I just thought I'd check I'm
>not being monumentally stupid first!
>
>I'm trying to animate my app's Dock icon, which works fine and looks
>great, but unfortunately, it appears to leak memory like crazy.
>Every time I call [NSApp setApplicationIconImage:(NSImage *)] and
>pass it pointer to an existing image, it leaks more memory.
Wrap each call to setApplicationIconImage in an autorelease pool creation
and release, like this:
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[NSApp setApplicationIconImage: whatever];
[pool release];
I think you'll find that solves the problem.
m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
One of the 2007 MacTech Top 25: <http://tinyurl.com/2rh4pf>
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>
_______________________________________________
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