Re: UIDocument + NSFileWrapper crashes on opening
Re: UIDocument + NSFileWrapper crashes on opening
- Subject: Re: UIDocument + NSFileWrapper crashes on opening
- From: Quincey Morris <email@hidden>
- Date: Thu, 20 Jun 2013 14:52:19 -0700
On Jun 20, 2013, at 14:37 , Markus Spoettl <email@hidden> wrote:
> OK, but isn't NSFileWrapper supposed to facilitate exactly that by providing sub-wrappers instead of actual data of contained files/folders, which can be read on demand when needed?
No, NSFileWrapper provides *lazy* loading, in the sense that you don't need to load a file until/unless it's actually needed. It doesn't provide any mechanism for evicting file contents from memory -- not that I can find, and I looked hard. If you need to read all the files, they will all eventually be in memory.
This is doubly irritating, because if the file contents is an archive, or otherwise needs to be converted or expanded, then both the raw data and unarchived data are in memory.**
This is distinct from *incremental* loading, which loads the raw data in pieces and only temporarily. This cannot -- in practical way -- be done with NSFileWrapper.
I spent a lot of time going round in circles about this, so I'm speaking up here in case I've missed something obvious, in which case someone will jump in and correct me. But AFAIK NSFileWrapper isn't the way to go for managed, incremental loading.
** What makes this acceptable in a lot of cases is that NSFileWrapper may read files by memory mapping them. This can perform as well as, or better than, a properly functioning cache, at the expense of using up additional VM address space.
_______________________________________________
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