[erlang-questions] append to a memory-mapped file

Joel Meyer <>
Thu Dec 16 23:27:31 CET 2010


On Thu, Dec 16, 2010 at 3:59 AM, Max Lapshin <> wrote:

> On Thu, Dec 16, 2010 at 2:57 PM, Joel Reymont <> wrote:
> >
> > On Dec 16, 2010, at 11:55 AM, Max Lapshin wrote:
> >
> >> Maybe syscall mremap will help you to enlarge mmaped file?
> >
> > I'll look into it. There's no mremap on Mac OSX, though.
> >
>
> So, mmap + munmap (exactly this sequence not to loose memory).


That assumes you're only reading from the mmap'ed region and don't need to
worry about running out of available address space for mmap'ing (not sure
how much the OS makes available for this). in my case I typically: lock +
msync + mmunmap + mmap + unlock to guarantee that the data is consistent and
release the address space that was in use before requesting another (larger)
region.


> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:
>
>


More information about the erlang-questions mailing list