On Mon, Oct 17, 2011 at 9:26 PM, Wilker <wilkerlu...@gmail.com> wrote:
> Hi guys,
>
> Im having a little problem here with reading NSData from a file, this is the
> line that starts the reading:
>
>    NSData *fileData = [NSData dataWithContentsOfFile:path
> options:NSDataReadingMappedAlways | NSDataReadingUncached error:&error];
>
> I wanna it mapped always and uncached because I don't wanna read the entire
> file, just some pieces of it (small pieces), so, if the user is acessing a
> file from an external drive, and the file has 8gb, I only wanna read 64kb,
> so, I don't wanna read it all just for 64kb.
>
> Giving that, sometimes, I'm receiving some crash reports, by bad memory
> access, I mean it should be the map got unavailable (maybe removed the drive
> or something), and the software crashes...

This is precisely why the default behavior was changed to only map
files from internal volumes. Read the Lion Foundation Release Notes;
search for "Safe File Mapping":
http://developer.apple.com/library/mac/#releasenotes/Cocoa/Foundation.html

--Kyle Sluder
_______________________________________________

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