Plugging a pseudo-memory leak
Delaney, Timothy (Tim)
tdelaney at avaya.com
Wed Jul 4 19:08:18 EDT 2007
Adam Atlas wrote:
> I have a program that seemed to be leaking memory, but after
> debugging, it seemed it just wasn't getting around to collecting the
> objects in question often enough. The objects are very long-lived, so
> they probably end up in generation 2, and don't get collected for a
> long time. Is there any way I can force collection of these objects? I
> know in Python 2.5 there's gc.collect(2), but I want to keep it
> compatible with previous versions of Python.
Best way is to not create cycles. See if you can change some strong
references to weakrefs.
Tim Delaney
More information about the Python-list
mailing list