On 08/23/2010 11:40 AM, AJ ONeal wrote:
> Would it be true to say that if I allocate 120MB of memory with `malloc()`
> that the physical memory underneath may actually be a block of 80MB and
> 40MB?

Not sure I understand your question.

How much of the 120 MB of memory is resident (in physical memory)
depends on the memory pressures and how the OS schedules things.  If you
malloc the memory and do nothing with it, odds are zero bytes of the 120
MB will be resident.

> Now with a system with 4GB+ of memory, perhaps that's not very likely... but
> it is possible, correct?

Only if there's no swap enabled.  If swap is enabled, the kernel will
likely swap out pages that aren't actually being actively used so that
the physical RAM can be used for more useful things like disk caching.
--------------------
BYU Unix Users Group 
http://uug.byu.edu/ 

The opinions expressed in this message are the responsibility of their
author.  They are not endorsed by BYU, the BYU CS Department or BYU-UUG. 
___________________________________________________________________
List Info (unsubscribe here): http://uug.byu.edu/mailman/listinfo/uug-list

Reply via email to