• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
preventing bad memory access
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

preventing bad memory access


  • Subject: preventing bad memory access
  • From: Wilker <email@hidden>
  • Date: Mon, 17 Oct 2011 21:26:13 -0700

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...

There is any way to handle it? Any kind of try/catch that I can do while
reading the bytes, so, I can recover from the error?
---
Wilker LĂșcio
http://about.me/wilkerlucio/bio
Kajabi Consultant
+55 81 82556600
_______________________________________________

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

  • Follow-Ups:
    • Re: preventing bad memory access
      • From: Jens Alfke <email@hidden>
    • Re: preventing bad memory access
      • From: Scott Ribe <email@hidden>
    • Re: preventing bad memory access
      • From: Kyle Sluder <email@hidden>
  • Prev by Date: Re: 'Static' items in an NSOutlineView
  • Next by Date: How to remove items from NSCollectionView without view selection
  • Previous by thread: Re: Code signing issues
  • Next by thread: Re: preventing bad memory access
  • Index(es):
    • Date
    • Thread