Re: Excessive open gui graphics files on Mavericks
Re: Excessive open gui graphics files on Mavericks
- Subject: Re: Excessive open gui graphics files on Mavericks
- From: Jens Alfke <email@hidden>
- Date: Tue, 08 Apr 2014 16:15:21 -0700
On Apr 8, 2014, at 12:13 PM, Michael Domino <email@hidden> wrote:
> The difference is the graphics files used by the gui. There are no .png files opened on 10.6 while the app is at idle, but on Mavericks we have all of these taking up file descriptors (partial lsof output below).
IIRC, the AppKit release notes for 10.9 (or 10.8?) talk about behavior changes in +[NSImage imageNamed:]. Putting that together with what you’re saying, it may be that it now memory-maps the image data instead of copying it into heap space. That would be more memory efficient but has the side effect of consuming a file descriptor.
> I don't directly open any of these files, and the only visible icons at the time are the 15 main toolbar buttons.
> So is there a way to change this behavior and close these files?
I suspect you didn’t directly open the files, but called +[NSImage imageNamed:] and retained the NSImage object, which is now hanging onto a file descriptor.
If this is true, you may be able to get around it by either keeping fewer of these resource-based NSImages around, at least not ones that aren’t currently being displayed, or by loading them using a different API. For example you could load the data into an NSData and then create an NSImage from that.
Disclaimer: This is total speculation and quite possibly wrong. But it should at least give you some ideas for experiments or workarounds.
—Jens
_______________________________________________
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