Re: NSImage leaks open file in 10.8.2?
Re: NSImage leaks open file in 10.8.2?
- Subject: Re: NSImage leaks open file in 10.8.2?
- From: Nick Zitzmann <email@hidden>
- Date: Wed, 13 Feb 2013 13:54:26 -0700
On Feb 13, 2013, at 2:12 AM, norbert <email@hidden> wrote:
> In Mac OS X 10.6.8, it works fine, and closes the image files after use. But in 10.8.2, it keeps every single one of them open.
>
> Here is the code I use:
>
> NSImage *nextImage = [NSImage imageNamed:@"Animator1.png"];
> if (nextImage != NULL)
> [myImageView setImage:nextImage];
>
> myImageView is a regular NSImageView. The app is non GC, and non ARC.
>
> Is that a new "feature" of Mountain Lion?
Maybe. +imageNamed: does some caching behind the scenes, and this is explained in the method's documentation. If you need image files to be opened, read into memory, and then closed, then the first thing I would try is initializing them from unmapped NSData objects created using +dataWithContentsOfURL:options:error:.
Nick Zitzmann
<http://www.chronosnet.com/>
_______________________________________________
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