[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: mmap investigations



Hi,

> 1) mmap() call actually doesn't map whole memory (mmap() has successfully mmap'ed 23 GiB,
> of course I have no such amounts of memory on my desktop); process memory are untouched at
> all;

This is implementation defined behaviour.

> 2) mmap() call doesn't grow a file attached to it, file size stays untouched directly
> after mmap();

This is implementation defined behaviour.

> 3) when writing to mmap'ed region, file size become maximum of offsets that were used for
> writing.

This is implementation defined behaviour.

> These investigations incited me to wonder if we... can simply do mmap(2GiB -1) amount of
> memory, without any troubles?!

No.

For example, the following behaviour would also be legal:

 - on mmap(), allocate 2 GiB of memory, load the current file contents into
   it, extend the file on disk to 2 GiB.
 - on write, write to memory only.
 - on msync/munmap/process exit, write the 2 GiB out to disk.

   Simon

Attachment: signature.asc
Description: Digital signature


Reply to: