All of lore.kernel.org
 help / color / mirror / Atom feed
* Memory usage of a process
@ 2009-07-10  9:08 Günter Leonhardt
  2009-07-11 10:05 ` Nicholas Mc Guire
  0 siblings, 1 reply; 2+ messages in thread
From: Günter Leonhardt @ 2009-07-10  9:08 UTC (permalink / raw)
  To: linuxppc-dev

=20
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?

G=FCnter

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Memory usage of a process
  2009-07-10  9:08 Memory usage of a process Günter Leonhardt
@ 2009-07-11 10:05 ` Nicholas Mc Guire
  0 siblings, 0 replies; 2+ messages in thread
From: Nicholas Mc Guire @ 2009-07-11 10:05 UTC (permalink / raw)
  To: G?nter Leonhardt; +Cc: linuxppc-dev

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-07-11 10:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-10  9:08 Memory usage of a process Günter Leonhardt
2009-07-11 10:05 ` Nicholas Mc Guire

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.