Tracking memory usage and object life time.

Bjoern Schliessmann usenet-mail-0306.20.chr0n0ss at spamgourmet.com
Wed Sep 26 08:31:00 EDT 2007


Berteun Damman wrote:

> When I run a test, I disable the garbage collection during the
> test run (as is adviced), but just before starting a test I
> instruct the garbage collector to collect. Running the test
> without disabling the garbage collect doesn't show any difference
> though.

Did you check the return value of gc.collect? Also, try using
other "insight" facilities provided by the gc module.

> Where possible I explicitly 'del' some of the larger data
> structures that have been created after I don't need them anymore.

You cannot "del" structures, you only "del" names. Objects are
deleted when they are not bound to any names when and if the
garbage collector "wants" to delete them.

> I furthermore don't really see why there would be references to
> these larger objects left. (I can be mistaken of course).

Be sure to check for cyclic references, they can be a problem for
the GC.
 
Regards,


Björn

-- 
BOFH excuse #343:

The ATM board has run out of 10 pound notes.  We are having a whip
round to refill it, care to contribute ?




More information about the Python-list mailing list