On Jun 20, 2013, at 22:05 , Markus Spoettl <ms_li...@shiftoption.com> wrote:
> It seems that the default implementation of UIDocument uses an NSFileWrapper > initialized with the NSFileWrapperReadingImmediate reading option. > > When I create a NSFileWrapper not using that option it works, meaning it now > opens and loads the package document it previously crashed on. I wonder what > surprises I will run into with lazy wrapper loading like that. Initial tests > show no problems when changing the document and saving the whole thing. For > now it seems to work exactly like on OSX. > > 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. That's assuming you actually read all of the files. If you don't access the data, it won't have any performance impact. You might get away with this on iOS, but on OS X it's all going to come unstuck if the document file is on a disk that doesn't allow memory mapping, such as a network volume. One of these days I'm going to write an experimental app that tries to figure out what happens when. _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com