On 6 Mar 2008, at 00:13, Kyle Sluder wrote:

On Wed, Mar 5, 2008 at 6:40 PM, Torsten Curdt <[EMAIL PROTECTED]> wrote:
I though NSData would handle the access just transparently. Otherwise
that would be good to keep in mind also for files slightly smaller
than 2GB :)

While NSData certainly has the capability to do memory-mapped IO, it
would be rather useless if that was all it can do.

Look into +[NSData dataWithContentsOfMappedFile:].

Unfortunately that doesn't really help. On 32-bit systems, the limitation is (usually) address space, not RAM or swap. IIRC OS X does leave more than 2GB of address space free for applications, but it's easy to fragment it and end up in a situation where the largest contiguous piece is too small.

If you need to load more than 2GB of data into "memory", you're going to want to be 64-bit. If, on the other hand, you can load it in pieces somehow, that's the way to go here. Depending on the data you're working with, you may also find that you could approach the problem differently, e.g. by processing it as a stream, or by entering it into a database engine (most DB engines are already set up to cope with more data than will fit in RAM).

Unfortunately the best solution is dependent on the application domain.

Kind regards,

Alastair.

--
http://alastairs-place.net


_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to