Re: How to split a big file ?
Re: How to split a big file ?
- Subject: Re: How to split a big file ?
- From: William Bumgarner <email@hidden>
- Date: Mon, 20 Mar 2006 09:53:44 -0800
On Mar 20, 2006, at 9:01 AM, Damien Bobillot wrote:
Paul J. Lucas wrote :
On Mon, 20 Mar 2006, Michaël Parrot wrote:
I would like split file with 10MB (or more) segment.
But, when split 250MB or more datas, OS X swap and use more RAM.
Also, I try it with split command.
How I can reduce this memory usage ?
While this has nothing to do with Cocoa:
man mmap
You get exactly the same functionalities with +[NSData
dataWithContentsOfMappedFile:], it's just more cocoa.
That is incorrect. With a significant large file, there is no way to
avoid address space exhaustion by mapping the entire file contents.
The NSData API does exactly that; map the entire file contents.
The mmap() function allows you to map subsections of the file. For
the purposes of splitting a file, you could simply map chunks of the
file into memory, writing out each chunk before mapping the next.
Of course, there is probably some uber-1337 way of doing this even
more efficiently.
You could also grab the method used by split, as the source is
available. It simply uses read()/write() to do the split in up to
1MB blocks.
http://www.opensource.apple.com/darwinsource/10.4.5.x86/text_cmds-47/
split/split.c
b.bum
_______________________________________________
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