ram_nambiar
asked on
Stack and heap size of a running program
How to find the stack and heap size of a running program in Linux and Solaris?
Thanks
Ram
Thanks
Ram
ulimit only prints out the limits; not the actual size of a running process.
I think you will find the pmap program useful. It produces output like:
$ pmap 2635
2635: -/bin/bash
08048000 592K r-x-- /bash
080dc000 24K rw--- /bash
080e2000 148K rwx-- [ anon ]
40000000 84K r-x-- /ld-2.3.4.so
40015000 4K rw--- [ anon ]
40016000 8K rw--- /ld-2.3.4.so
40018000 8K rw--- [ anon ]
4001b000 8K r-x-- /libdl-2.3.4.so
4001d000 8K rw--- /libdl-2.3.4.so
4001f000 1088K r-x-- /libc-2.3.4.so
4012f000 4K ----- /libc-2.3.4.so
40130000 4K r---- /libc-2.3.4.so
40131000 12K rw--- /libc-2.3.4.so
40134000 8K rw--- [ anon ]
40136000 28K r-x-- /libnss_compat-2.3.4.so
4013d000 8K rw--- /libnss_compat-2.3.4.so
4013f000 68K r-x-- /libnsl-2.3.4.so
40150000 8K rw--- /libnsl-2.3.4.so
40152000 8K rw--- [ anon ]
40154000 32K r-x-- /libnss_nis-2.3.4.so
4015c000 8K rw--- /libnss_nis-2.3.4.so
4015e000 32K r-x-- /libnss_files-2.3.4.so
40166000 8K rw--- /libnss_files-2.3.4.so
bfffa000 24K rwx-- [ stack ]
total 2224K
$
The "[ stack ]" line shows you the size of the stack.
All of the 40xxxxxx entries represent dynamic libraries mmap'ed into the process space.
I believe the "080e2000 148K rwx-- [ anon ]" line represents the heap.
I think the first two "bash" entries represent the segments of the /bin/bash binary.
I think you will find the pmap program useful. It produces output like:
$ pmap 2635
2635: -/bin/bash
08048000 592K r-x-- /bash
080dc000 24K rw--- /bash
080e2000 148K rwx-- [ anon ]
40000000 84K r-x-- /ld-2.3.4.so
40015000 4K rw--- [ anon ]
40016000 8K rw--- /ld-2.3.4.so
40018000 8K rw--- [ anon ]
4001b000 8K r-x-- /libdl-2.3.4.so
4001d000 8K rw--- /libdl-2.3.4.so
4001f000 1088K r-x-- /libc-2.3.4.so
4012f000 4K ----- /libc-2.3.4.so
40130000 4K r---- /libc-2.3.4.so
40131000 12K rw--- /libc-2.3.4.so
40134000 8K rw--- [ anon ]
40136000 28K r-x-- /libnss_compat-2.3.4.so
4013d000 8K rw--- /libnss_compat-2.3.4.so
4013f000 68K r-x-- /libnsl-2.3.4.so
40150000 8K rw--- /libnsl-2.3.4.so
40152000 8K rw--- [ anon ]
40154000 32K r-x-- /libnss_nis-2.3.4.so
4015c000 8K rw--- /libnss_nis-2.3.4.so
4015e000 32K r-x-- /libnss_files-2.3.4.so
40166000 8K rw--- /libnss_files-2.3.4.so
bfffa000 24K rwx-- [ stack ]
total 2224K
$
The "[ stack ]" line shows you the size of the stack.
All of the 40xxxxxx entries represent dynamic libraries mmap'ed into the process space.
I believe the "080e2000 148K rwx-- [ anon ]" line represents the heap.
I think the first two "bash" entries represent the segments of the /bin/bash binary.
Quite so, I mis-assumed he wanted to know what sizes they were given.
corey
corey
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
will give you the stack size limits.
corey