getrusage
Gerhard Häring
gh at ghaering.de
Wed Sep 10 19:49:36 EDT 2003
Stuart D. Gathman wrote:
> When I call resource.getrusage on Linux, I don't get any memory stats:
>
> Python 2.2.2 (#1, Jan 30 2003, 21:26:22)
> [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>
>>>>from resource import getrusage,RUSAGE_SELF
>>>>print getrusage(RUSAGE_SELF)
>
> (0.019531, 0.0078119999999999995, 0, 0, 0, 0, 178, 387, 0, 0, 0, 0, 0, 0, 0, 0)
>
> On AIX, I get the correct numbers.
On FreeBSD, you get correct numbers as well. The Linux kernel, however,
doesn't implement the RUSAGE field, even though it could easily be done
(I once had the same question as you, and did this research then).
> What is the goal? I need to find a memory leak in an extension module.
Try compiling a debug version of Python with the option --with-debug and
you can debug refcount problems much better.
-- Gerhard
More information about the Python-list
mailing list