• 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
Re: file reading/writing over 2 gig
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: file reading/writing over 2 gig


  • Subject: Re: file reading/writing over 2 gig
  • From: Sherm Pendley <email@hidden>
  • Date: Sun, 12 Aug 2007 03:35:55 -0400

On Aug 12, 2007, at 12:07 AM, Jaime Magiera wrote:

What is the preferred method for positional reading/writing of files in Cocoa? For small files, NSFileHandle and NSData work great. However, NSData caps at 2 gig. Is there another Cocoa solution?

NSFileHandle isn't "capped" at 2G - its -offsetInFile and - seekToFileOffset: methods return and take unsigned long long ints, respectively. So, one can read/write at any position within Files of Unusual Size with no trouble.


NSFileHandle's -readDataOfLength: method, as well as NSData methods that deal with offsets and sizes, do take and return unsigned longs, because a 32-bit app can address "only" 4GB of memory at most. That's what limits the amount of data you can read into memory at one time, even though NSFileHandle will allow you to read that 4GB from any position within a much larger file. That limitation applies to all 32- bit apps, not just those that use Cocoa.

A 64-bit app can address much more memory, but deploying such a beast has problems of its own. It requires a 64-bit processor, which limits it to G5s and Mac Pros. Also, 64-bit support is currently limited to BSD/POSIX functions only - neither Cocoa nor Carbon are currently 64- bit. That means you'd need to factor your app into separate 32-bit GUI and 64-bit "worker" processes, and implement some form of IPC to communicate between them.

sherm--


Web Hosting by West Virginians, for West Virginians: http://wv-www.net Cocoa programming in Perl: http://camelbones.sourceforge.net


_______________________________________________

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: file reading/writing over 2 gig
      • From: Jaime Magiera <email@hidden>
    • Re: file reading/writing over 2 gig
      • From: Alastair Houghton <email@hidden>
References: 
 >file reading/writing over 2 gig (From: Jaime Magiera <email@hidden>)

  • Prev by Date: file reading/writing over 2 gig
  • Next by Date: Re: file reading/writing over 2 gig
  • Previous by thread: file reading/writing over 2 gig
  • Next by thread: Re: file reading/writing over 2 gig
  • Index(es):
    • Date
    • Thread