On Fri, 8 Aug 2008 23:53:08 +0100, Mark Allan <[EMAIL PROTECTED]> said: >>On Fri, Aug 8, 2008 at 9:02 AM, Matt Neuburg <[EMAIL PROTECTED]> wrote: >>> On Thu, 7 Aug 2008 20:14:04 +0100, Mark Allan <[EMAIL PROTECTED]> >>> 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.
>Sorry, I should have said in my original message that I'd already >tried that, and the autorelease pool did solve the problem. Yes, that sure would have been a nice thing to do. >At 6:24 pm -0400 08/08/2008, Sumner Trammell wrote: >>Is the need for the autorelease pool because of the use of >>setApplicationIconImage, or because of the array that is being used in >>conjunction with setApplicationIconImage? >Your idea of removing the >array from the equation also solves the leak and I suspect is more >efficient than creating and releasing a tonne of autorelease pools. Really? Can you explain what "removing the array from the equation" has to do with the memory behavior you're seeing? m. -- matt neuburg, phd = [EMAIL PROTECTED], <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 (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]