> Try running fs_usage while your app is running, and you’ll be able to see 
> what files it opens and in which modes.
> (Or there’s probably an Instrument for that now?)

There's half a dozen related to file I/O, which unfortunately makes it very 
awkward to use for even simple tasks like this.  You also need to manually add 
in the VM instrument, since it's not in the "File Activity" template, in order 
to see the actual mmap.  fs_usage is much faster.

On 10.7 -[NSData initWithContentsOfMappedFile:] opens the file read-only.  So 
does -[NSData initWithContentsOfFile:].  Even if you instantiate an 
NSMutableData instead, the file is still opened read-only.  I have not tested 
on iOS, but I'd be surprised if it were any different.

Note also that initWithContentsOfMappedFile: is deprecated in 10.7.  There 
doesn't appear to be a replacement; I presume you're supposed to use 
initWithContentsOfFile:, but that really does read the entire file in at init 
time (into a single malloc allocation, no 
less)._______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to