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

Working with large files and Memory


  • Subject: Working with large files and Memory
  • From: "Carl E. McIntosh" <email@hidden>
  • Date: Tue, 11 Mar 2008 12:54:51 -0400

Can you please give advice about handling large data files with memory management techniques? I am attempting to read three large files (1 GB, 208 MB, 725 MB) sequentially and place the data into arrays for processing. Here is my psuedocode:

1) Import a file into NSString.
NSString *aFileString = [NSString stringWithContentsOfFile: fileLocation]; // Convert file at path to myFileString text holder;


2) Use NSScanner pull out integers and floats
NSScanner *aFileScanner = [[NSScanner alloc] initWithString: aFileString];


3) Store values into arrays.
      float myFloats [100000][2000]; or
      float myInts [100000][2000];

4) repeat three times with 3 different files.

This algorithm works for smaller files but chokes on the larger files and I get malloc errors. I've attempted to use NSZone's to the same failure.

Can you please give advice about handling large data files with memory management techniques?

I have 4 GB ram and can hog off 2 - 3 GBs for the process. I don't know how to explicitly allocate real memory. I'd rather not use virtual memory. Any references or examples would be appreciated.


Thank you. Carl




_______________________________________________

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: Jean-Daniel Dupas <email@hidden>
    • Re: Working with large files and Memory
      • From: "Clark Cox" <email@hidden>
  • Prev by Date: Re: Button on a button
  • Next by Date: cross development ppc intel problem
  • Previous by thread: [MEET]: Los Angeles CocoaHeads Thursday March 13th 7:30pm
  • Next by thread: Re: Working with large files and Memory
  • Index(es):
    • Date
    • Thread