Re: Memory intensive processes (fwd)

Jim Nance (
Wed, 11 Dec 1996 19:50:31 -0500 (EST)

> Yes, Linux does something LIKE this. But I beleive that the malloc..ed
> memory was allocated (all of it), but marked read-only. When a write
> to the memory occurs, the kernel makes a physical allocation and marks
> it read/write. However, I think that all of it gets allocated when
> a write occurs, at least everything up to the point at which the write
> occurred. I think that if you write a single byte at the end of your
> 20 megabyte buffer, the whole buffer then becomes "REAL" rather than a
> single page. You might check this out. Note that the ix86 makes it

OK, I just checked it out. If I write to buff[max-1] in the program,
nothing significant changes. Also one of the frequent complaints about
linux is that you can allocate far more memory than you have ram+swap.
You only get into trouble if you try to use more of it than you have
the ram+swap to cover. This leads me to believe that it did not really
allocate the memory, but is playing page table tricks like you are taling