How to get memory usage for process?

Uwe Doering gemini at
Fri Apr 9 00:59:04 PDT 2004

Artem Koutchine wrote:
> Hi!
> I need to figure out how much memory process really takes.
> For example, i am running 100 perl scripts, they are all the
> same source and i guess some memory is shared among them
> (mostly perl interperter i guess). So, i need to know how much
> memory is shared and how much memory is used for each new
> running script (including buffers, e.t.c.). What command shoud
> do the trick and with what options?

In case you have the PROCFS mounted (usually under /proc) you can get a 
detailed listing of the memory map of a process, together with the 
relevant flags for the various memory segments that indicate memory 
sharing etc.  Try this:

   cat /proc/<pid>/map

'<pid>' is of course to be replaced by the PID of the process you want 
to examine.

Uwe Doering         |  EscapeBox - Managed On-Demand UNIX Servers
gemini at  |

More information about the freebsd-questions mailing list