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: email@hidden
- Date: Wed, 09 Apr 2014 14:22:12 +0900
> On 2014/04/09, at 13:28, Jens Alfke <email@hidden> wrote:
>
>
>> On Apr 8, 2014, at 8:57 PM, Maxthon Chan <email@hidden> wrote:
>>
>> You can avoidd this by consolidating all your resource files into one big archive file that is expanded in-memory into NSData files. I still vaguely remember a library that parses tar file into a dictionary of NSData objects. You can use that library to consolidate all your resources into one single tarball.
>
> I don’t think that has anything to do with this. If you want to avoid +imageNamed:, it’s easy to load individual image files as data, as I said, without having to change anything about the way the resources are stored on disk.
>
> ―jens
It might be good to know if any of the file descriptors are pointing to the same files.
From the lsof snippet the files are in your bundle so look at how your code is loading resources. If you have duplicate descriptors you want to find a way to load lazily, load once and let go if the descriptor when not in use.
Here's one way.
If you have tons of images, borrow a page from Sprite Kit, use an image atlas. One descriptor, many positional images.
It's just an image with subimages at known positions. Then you can reuse the same image and just draw the parts you need where you need them.
Other similar alternatives.
Base64 encode images into one file. It could even be an SQLite db file.
Fetch the encoded images you need and decode.
_______________________________________________
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