calculating the memory footprint of an application

calculating the memory footprint of an application

Post by Erwin Richar » Wed, 04 Sep 2002 01:48:08



I have an application in which several processes communicate with each other
through shared memory and other IPC mechanisms.
All of these processes share a great deal of common code (such as the Java
Runtime, Oracle libraries etc).

I would like to know how much physical memory this application uses, but
simply using the SZ field of the ps(1) command does not
give a realistic nuber as shared memory regions are counted more than once.

One way I could imagine would be to run pmap on all processes and add the
individual private regions plus the shared ones. But I'm
almost sure that must be an easier way(?).

Erwin

 
 
 

calculating the memory footprint of an application

Post by Jimm » Wed, 04 Sep 2002 02:36:21



> I have an application in which several processes communicate with each
other
> through shared memory and other IPC mechanisms.
> All of these processes share a great deal of common code (such as the Java
> Runtime, Oracle libraries etc).

> I would like to know how much physical memory this application uses [...]

You realise that this may change over time?  Assuming that's okay, add up
the RSS (resident set size), as this represents the number of pages actually
in RAM at that moment in time.  However, this statistic doesn't
differentiate
between private and shared (common) pages.

Cheers
Jimmo

 
 
 

calculating the memory footprint of an application

Post by Erwin Richar » Thu, 05 Sep 2002 19:08:50


Thanks Jimmo,

Assuming that this is probably a quite common problem, I searched the net a
bit and found the script "procmem" that calculates these values nicely from
running pmap on all processes and adding private and shared pages correctly.

http://www.solarisdatabases.com/utilities/procmem

This does exactly what I needed.

Erwin



> > I have an application in which several processes communicate with each
> other
> > through shared memory and other IPC mechanisms.
> > All of these processes share a great deal of common code (such as the
Java
> > Runtime, Oracle libraries etc).

> > I would like to know how much physical memory this application uses
[...]

> You realise that this may change over time?  Assuming that's okay, add up
> the RSS (resident set size), as this represents the number of pages
actually
> in RAM at that moment in time.  However, this statistic doesn't
> differentiate
> between private and shared (common) pages.

> Cheers
> Jimmo

 
 
 

calculating the memory footprint of an application

Post by Sean O'Neil » Fri, 06 Sep 2002 02:49:04


On Wed, 4 Sep 2002 12:08:50 +0200, "Erwin Richard"


>http://www.solarisdatabases.com/utilities/procmem

This script uses the pmap command with the -x switch.  Unfortunately,
there is a bug pmap that over-estimates the size of applications when
using the -x switch.

You can download the pmem command which comes as part of the Memtool
package.  You can download the entire Memtool package from:

ftp://playground.sun.com/pub/memtool

Text describing bug and download location for just the pmem command as
follows:

Solaris pmap -x bug
-------------------

Solaris 2.6, 7 and 8 has a bug in pmap -x which will over-estimate the
amount of private memory for a process. The MemTool pmem command
should be used in place of pmap -x for accurate memory analysis.

Until a patch for Solaris is available, a stand alone version of pmem
that works without MemTool can be used safely on machines which you
don't want to load the complete MemTool package. It is available from:

ftp://playground.sun.com/pub/memtool/pmem.sparc

--
........................................................
......... ..- -. .. -..- .-. ..- .-.. . ... ............
.-- .. -. -... .-.. --- .-- ... -.. .-. --- --- .-.. ...

Sean O'Neill