Re: UIDocument + NSFileWrapper crashes on opening
Re: UIDocument + NSFileWrapper crashes on opening
- Subject: Re: UIDocument + NSFileWrapper crashes on opening
- From: Markus Spoettl <email@hidden>
- Date: Fri, 21 Jun 2013 12:40:38 +0200
On 6/21/13 8:19 AM, Quincey Morris wrote:
What is interesting too is that my application was able to create the whole
wrapper structure when it first created the package. It would have required
the same amount of memory to hold the wrappers in memory before they get
written to the disk by UIDocument. Maybe it has to do with the fact that it is
creating the structure incrementally and relatively slowly while downloading
objects over the network. Reading the UIDocument from disk on the other hand
requires it to load everything instantly. Maybe there's some system safeguard
in place that kills apps whose memory usage increases too rapidly.
I think the short answer is that your files are being memory-mapped rather than
read via I/O. That means the result is dependent on the VM swapping caused by
your pattern of access.
When a new file wrapper is added to an existing wrapper UIDocument/the framework
hasn't had a chance to memory map it because I didn't hand over the root file
wrapper yet. That inspired the thought that saving - even incrementally - will
use all memory necessary to load the whole thing.
I clearly don't know enough about the inner workings of NSFileWrapper but can it
be that a wrapper which I hold on to from the time I first created it switches
it's backing from in-memory to memory mapped disk once it has been saved? That
would explain why incremental saving worked but loading didn't.
Regards
Markus
--
__________________________________________
Markus Spoettl
_______________________________________________
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