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

Re: OT: free cmd is lying to me



On Mon, 2001-12-03 at 11:34, dman wrote:
> On Mon, Dec 03, 2001 at 10:13:43AM -0600, Michael Heldebrant wrote:
> | On Mon, 2001-12-03 at 03:04, Holger Rauch wrote:
> | > On 2 Dec 2001, Michael Heldebrant wrote:
> | > 
> | > > IIRC from the Understanding the Linux Kernel book by O'Reilly, linux
> | > > doesn't actually worry about memory until you actually use it.  I'm not
> | > > sure if a malloc counts as using it for storing data since I'm no C
> | > > programmer but unless you actually write to the memory linux doesn't
> | > > bother setting up the actual pages since it's a waste for the system to
> | > > make and tear down pages that are never accessed.
> | > 
> | > You mean I actually have to write data to the malloc()ed memory region?
> | 
> | I beleive so, if it's just malloced and not used the kernel won't bother
> | making the page until the last second when it's needed for a read or
> | write.  I'll go read my kernel book again and report back if thats not
> | the case.
> 
> Read the book?  If it is in print, it is out-of-date with recent
> volatility of the VM system.  Though I think you can get a good
> point-of-reference from your book anyways.  Its even possible (likely,
> I would think) that this hasn't changed (aside from bugfixes and
> performance improvements).

It's true that the underlying structures and algorithms most likely are
compeltely different but I think the concept of not making pages until
you need them is most likely quite sound in any recent linux kernel
now.  

Though for the definitive answer we could always browse the source.

--mike



Reply to: