[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How a can get the process heap size?
On Thu, Nov 13, 2003 at 14:54:31 -0500, Ed L Cashin wrote:
> <Allan.Bezerra@indt.org.br> writes:
>
> > Hi,
> >
> > How a can get the heap size from a specific process?
> >
> > I saw that /proc file system don't provide this.
>
> What about the maps file? I have a test program that cats its maps
> file, allocates 20 pages, writes to the first and last page, and then
> cats the maps file again. The output is shown below, where you can
> see a new VMA 20 pages in size in the "after" case:
But they are virtual memory pages, NOT PHYSICAL. Only the two (the first
and last) are actualy present in memory.
> ecashin@marblerye tmp$ ./a.out
> before
> 08048000-08049000 r-xp 00000000 03:03 166489 /tmp/a.out
> 08049000-0804a000 rw-p 00000000 03:03 166489 /tmp/a.out
> 40000000-40013000 r-xp 00000000 03:03 196431 /lib/ld-2.2.5.so
> 40013000-40014000 rw-p 00013000 03:03 196431 /lib/ld-2.2.5.so
> 40014000-40015000 rw-p 00000000 00:00 0
> 4001c000-4012f000 r-xp 00000000 03:03 196434 /lib/libc-2.2.5.so
> 4012f000-40135000 rw-p 00113000 03:03 196434 /lib/libc-2.2.5.so
> 40135000-40139000 rw-p 00000000 00:00 0
> bfffe000-c0000000 rwxp fffff000 00:00 0
> after
> 08048000-08049000 r-xp 00000000 03:03 166489 /tmp/a.out
> 08049000-0804a000 rw-p 00000000 03:03 166489 /tmp/a.out
> 0804a000-0805e000 rwxp 00000000 00:00 0
> 40000000-40013000 r-xp 00000000 03:03 196431 /lib/ld-2.2.5.so
> 40013000-40014000 rw-p 00013000 03:03 196431 /lib/ld-2.2.5.so
> 40014000-40015000 rw-p 00000000 00:00 0
> 4001c000-4012f000 r-xp 00000000 03:03 196434 /lib/libc-2.2.5.so
> 4012f000-40135000 rw-p 00113000 03:03 196434 /lib/libc-2.2.5.so
> 40135000-40139000 rw-p 00000000 00:00 0
> bfffe000-c0000000 rwxp fffff000 00:00 0
> ecashin@marblerye tmp$
>
>
> --
> --Ed L Cashin | PGP public key:
> ecashin@uga.edu | http://noserose.net/e/pgp/
>
> --
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive: http://mail.nl.linux.org/kernelnewbies/
> FAQ: http://kernelnewbies.org/faq/
>
-------------------------------------------------------------------------------
Jan 'Bulb' Hudec <bulb@ucw.cz>
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/