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?



>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.

No, sadly I can't explain it, but it does prevent the memory from leaking.

I changed my initialiser calls from
NSArray *imageX = [[NSArray arrayWithObjects: [NSImage imageNamed:@"menu_frame1"], [NSImage imageNamed:@"dock_frame1"], nil] retain];


to

NSImage *dockImageX = [[NSImage imageNamed:@"dock_frame1"] retain];

and for each frame of the animation, I'm passing that NSImage directly to the [NSApp setApplicationIconImage:theNewImage] call. Even without the autorelease pools, the app's memory usage now stays constant after the first animation of all 8 frames.

I fail to see how [NSApp setApplicationIconImage:theNewImage]; is any different to [NSApp setApplicationIconImage:[theNewImage objectAtIndex:1]] but it obviously does function differently.

Mark

_______________________________________________

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.