Garbage collection

Thinker thinker at branda.to
Wed Mar 21 10:10:17 EDT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Tom Wright wrote:
> Thinker wrote:
>> How do you know amount of memory used by Python? ps ? top or
>> something?
>
> $ ps up `pidof python2.5` USER PID %CPU %MEM VSZ RSS TTY
> STAT START TIME COMMAND tew24 26275 0.0 11.9 257592 243988
> pts/6 S+ 13:10 0:00 python2.5
>
> "VSZ" is "Virtual Memory Size" (ie. total memory used by the
> application) "RSS" is "Resident Set Size" (ie. non-swapped physical
> memory)
>
>
This is amount of memory allocate by process not Python interpreter.
It is managemed by
malloc() of C library. When you free a block memory by free()
function, it only return
the memory to C library for later use, but C library not always return
the memory to
the kernel.

Since there is a virtual memory for modem OS, inactive memory will be
paged
to pager when more physical memory blocks are need. It don't hurt
much if you have enough
swap space.

What you get from ps command is memory allocated by process, it don't
means
they are used by Python interpreter.

- --
Thinker Li - thinker at branda.to thinker.li at gmail.com
http://heaven.branda.to/~thinker/GinGin_CGI.py
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGATzJ1LDUVnWfY8gRAjSOAKC3uzoAWBow0VN77srjR5eBF0kXawCcCUYv
0RgdHNHqWMEn2Ap7zQuOFaQ=
=/hWg
-----END PGP SIGNATURE-----




More information about the Python-list mailing list