Re: appending to a memory-mapped file
Re: appending to a memory-mapped file
- Subject: Re: appending to a memory-mapped file
- From: Jens Alfke <email@hidden>
- Date: Wed, 6 Jan 2010 15:26:13 -0800
On Jan 6, 2010, at 1:39 PM, Jean-Daniel Dupas wrote:
> Just an idea, you can try to remap the same file with a larger size at the same address than the previous one using the MAP_FIXED flag. According to the man page, if you pass this flag, mmap try to "remove a mapping that already exists at that location". So it will automatically invalidate your previous mapping and create a new one with the new range (if there is enough room to do this of course, else it will failed).
It doesn't fail if there's not enough room; it just wipes out any other mappings that overlapped the address range. When I tried doing this, it ended up overwriting a large malloc zone, which caused some exciting and hard-to-debug crashes. :-(
—Jens _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden