Re: NSData Vs NSFileHandle For Extracting From Archive Files
Re: NSData Vs NSFileHandle For Extracting From Archive Files
- Subject: Re: NSData Vs NSFileHandle For Extracting From Archive Files
- From: Ondra Cada <email@hidden>
- Date: Fri, 21 Apr 2006 20:27:19 +0200
Duncan,
On 21.4.2006, at 7:15, Duncan Anker wrote:
NSData looks quite seductive in that it is possible to init with a
file's contents and then extract sub-data using the offset and
length to create ranges as needed. My main concern is with
attempting to read files of 50Mb or more in one go. My
understanding is that NSData will implicitly manage virtual memory
although I am not too clear on the implications of this. Does it
make a copy of the file, memory map onto the original file, or
possibly implement an internal FileHandle to read as required? When
I experimented with this a few days ago, I noticed the hard drive
seemed to thrash for a few seconds when the file was accessed which
made me wonder how much was being loaded and what was being left
for on-demand.
Do you use dataWithContentsOfMappedFile:? If so, there should be no
delay and the file should be mapped directly into your address space.
Far as your data do not exceed a few hundreds of MB, it would be
probably the best way. If there can be gigabyte-plus data though, you
may run out of the address space, and you'd have to go NSFileHandle
(or other technique).
---
Ondra Čada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden