How to optimize and monitor garbage collection?

kj no.email at please.post
Sun Oct 24 20:39:21 EDT 2010




I'm designing a system that will be very memory hungry unless it
is "garbage-collected" very aggressively.

In the past I have had disappointing results with the gc module:
I noticed practically no difference in memory usage with and without
it.  It is possible, however, that I was not measuring memory
consumption adequately.

What's the most accurate way to monitor memory consumption in a
Python program, and thereby ensure that gc is working properly?

Also, are there programming techniques that will result in better 
garbage collection?  For example, would it help to explicitly call
del on objects that should be gc'd?

TIA!

~kj



More information about the Python-list mailing list