Memory usage of a process

Nicholas Mc Guire mcguire at lzu.edu.cn
Sat Jul 11 20:05:48 EST 2009


On Fri, 10 Jul 2009, G?nter Leonhardt wrote:

>  
> Hello,
> analysing the memory usage of a process, I found some questions.
> I'am using a system with 128 MB physical RAM, no disk, 2.6.27 kernel.
> 
> Running top, I see 38 MB in use, 90 MB free, but a VSZ for my process of 158 MB.
> Looking at /proc/<pid>/maps, I see that the process uses 140 MB without shared libs.
> 
> So how it is possible that the process can allocate more memory than there is, without posibility of swapping?
>
> Why said top that 90 MB free? Does the kernel serve the allocation only if ist really used?
> 

an allocation does not actually set aside any physical ram (unless you do an mlock and actually touch the memory) - it only reserves virtual memory areas (vma's) and when your process accesses the respective address the OS page-faults and prvides the physical RAM as needed (and possible) - if you have no swap and you allow overcommitting of memory then you are potentially going to see this application failing as soon as it tries to utilize the memory.

This can be set in the system via /proc/sys/vm/overcommit_memory (see
linux/Documentation/vm/overcommit-accounting for details).
 
hofrat


More information about the Linuxppc-dev mailing list