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 PROTECTED]> 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 protected]) 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]
