Adrien Destugues wrote: > Le 05/12/2011 16:09, Rene Gollent a écrit : > > On Mon, Dec 5, 2011 at 10:08 AM, Rimas Kudelis<rq@xxxxxx> wrote: > >> ah, I see... I had no idea that on fork(), a child process gets the same > >> amount of memory as its parent by default... > > It more or less has to, since the child is an exact clone of the > > parent by fork() semantics. > > Don't we have some lazy copy-on-write thing there ? We do. But, as Rene explained, there's a difference between committing and allocated memory. When CoW'ing a writable area the system does not allocate twice the memory, but it does commit that much. Again, allocating memory means actually using physical pages (or slots in the swap file). Committing memory means, that the system ensures that that much memory can be allocated, if requested, but until then it can be used otherwise (e.g. for caching) or lies dormant (swap space). Committing memory on CoW is necessary, since writing to that area will cause memory allocations, which could otherwise fail and thus crash the program. CU, Ingo