Can I get the total memory usage of Python?

"Martin v. Löwis" martin at v.loewis.de
Fri May 23 05:38:18 EDT 2003


Haigu wrote:

> I'm embedding python in my program, and now I want to fully test my program
> to check for memory leaks. So is there any way to know how much memory is
> used by python?
> 
> Also is there any way to know how many certain kind of objects are
> allocated? say, how many intergers ?

In the release build, you can only find out how many container objects 
you have, with gc.getobjects(). In the debug build, you can get a list 
of all objects, which you can traverse to count them by type.

Regards,
Martin





More information about the Python-list mailing list