Re: Re: NSData dataWithContentsOfMappedFile with huge files?
Re: Re: NSData dataWithContentsOfMappedFile with huge files?
- Subject: Re: Re: NSData dataWithContentsOfMappedFile with huge files?
- From: "Michael Ash" <email@hidden>
- Date: Sun, 27 Aug 2006 08:48:35 -0400
On 8/27/06, Cameron Hayne <email@hidden> wrote:
On 25-Aug-06, at 4:54 PM, Shawn Erickson wrote:
> If NSData does a straight contiguous mapping (which it likely has to
> do given its API) the limit is just a little over 2 GiB in size
> (assuming a clean application heap).
Hmm, that makes sense. I guess it was wishful thinking - I was hoping
that it might do something super-smart behind the scenes such that it
could cover more than that as long as you didn't ask for too large a
chunk of 'bytes' at any one time.
Most use of NSData doesn't involve asking for a chunk, though. As soon
as you invoke -bytes, the game is up. You can index off of that
pointer as far into the data as you want. That means that -bytes has
to return a pointer to the beginning of the data, and it has to point
to a contiguous memory block until the end of the data.
If you want huge amounts of data in chunks, look at NSStream or any of
the other file handling APIs, which are numerous (but alas, not quite
so simple to use). Or switch to a 64-bit app, but that is ever so
slightly limiting right now.
Mike
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden