Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Does [NSApp setApplicationIconImage] leak memory?



On Fri, Aug 8, 2008 at 9:02 AM, Matt Neuburg <email@hidden> wrote:
> Wrap each call to setApplicationIconImage in an autorelease pool creation
> and release, like this:
>
>        NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
>        [NSApp setApplicationIconImage: whatever];
>        [pool release];

Okay, sorry for jumping in late, but I don't understand how this would
solve the problem.  Since we're talking about NSApplication, AppKit
has already created an NSAutoreleasePool, so it's not like
-setApplicationIconImage: is autoreleasing an object when there's no
autorelease pool stack.  Therefore, regardless of whether it's an
AppKit autorelease pool or your own autorelease pool, any autoreleased
object will still only get one -release message.  Creating your own
autorelease pool should only make it happen "now" instead of "later".

--Kyle Sluder
_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden

References: 
 >Re: Does [NSApp setApplicationIconImage] leak memory? (From: Matt Neuburg <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.