• 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: Working with large files and Memory
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Working with large files and Memory


  • Subject: Re: Working with large files and Memory
  • From: Carl McIntosh <email@hidden>
  • Date: Tue, 11 Mar 2008 21:24:16 -0700

Thank you to both for your good advice. I will look into this.
Carl.

On Tuesday, March 11, 2008, at 04:49PM, "Jens Alfke" <email@hidden> wrote:
>
>On 11 Mar '08, at 10:18 AM, Jean-Daniel Dupas wrote:
>
>> The first advice I can give you is "do not load the whole file into
>> memory".
>
>Absolutely.
>
>> Use read stream to read chunk of data and process them. (see
>> NSInputStream or NSFileHandle).
>
>Or if the file is simple ascii text with newlines, you can use basic C
>stdio calls (fopen, fgets, fclose) to read a line at a time. You can
>either convert the line into an NSString, or just use something like
>sscanf to parse it.
>
>In rare situations where you absolutely do have to load a huge file
>into memory, i.e. for an algorithm that requires random access, your
>best bet is to memory-map it. -[NSData
>dataWithContentsOfFile:options:] has an option flag to map the file.
>This will avoid a lot of copying, but it's still subject to the same
>address-space limit if your process is 32-bit, so don't expect to be
>able to load anything much over a gigabyte.
>
>?Jens
>
_______________________________________________

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: Working with large files and Memory
      • From: Scott Ribe <email@hidden>
References: 
 >Working with large files and Memory (From: "Carl E. McIntosh" <email@hidden>)
 >Re: Working with large files and Memory (From: Jean-Daniel Dupas <email@hidden>)
 >Re: Working with large files and Memory (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: NSURLDownload and userInfo
  • Next by Date: Prevent click through (Tiger and Leopard)
  • Previous by thread: Re: Working with large files and Memory
  • Next by thread: Re: Working with large files and Memory
  • Index(es):
    • Date
    • Thread