efficient Python object count
robert
no-spam at no-spam.invalid
Fri Nov 7 07:30:53 EST 2008
darrenr wrote:
>> Thanks for the quick reply. Could you provide a link to more
>> information on the debug build you refer to?
>
> A modified version of this algorithm should do the trick for my
> purposes, it finds the non-containers that gc ignores. I don't care
> how long it takes to compute, I just don't want the process to block
> for long periods of time.
>
> http://utcc.utoronto.ca/~cks/space/blog/python/GetAllObjects
Once I had a strange memory leak in a long running process. This
turned out to be a problem of objects filing up in gc.garbage
("uncollectables").
I think those objects where also not reachable through
gc.get_objects() - as used by the script above. So be aware. Maybe
you've got the same motive for your counter.
I was somewhat stunn seeing, that obviously almost any serious
bigger app needs to watch and handle/free the gc.garbarge list "by
hand", to remain stable.
Robert
More information about the Python-list
mailing list