How to optimize and monitor garbage collection?

Steve Holden steve at holdenweb.com
Mon Oct 25 00:04:13 EDT 2010


On 10/24/2010 8:39 PM, kj wrote:
> What's the most accurate way to monitor memory consumption in a
> Python program, and thereby ensure that gc is working properly?

Trust me, it is. But don't forget that CPython doesn't actually *use*
the garbage collector until you start to create cyclic data structures.
In their absence reference counting alone is sufficient to ensure that
unused object memory is reclaimed.

regards
 Steve

[aside: in general, if you think your program is not working because of
a bug in Python, look harder at your program].
-- 
Steve Holden           +1 571 484 6266   +1 800 494 3119
PyCon 2011 Atlanta March 9-17       http://us.pycon.org/
See Python Video!       http://python.mirocommunity.org/
Holden Web LLC                 http://www.holdenweb.com/




More information about the Python-list mailing list