[Python-Dev] suggestion for smarter garbage collection in function of size (gc.set_collect_mem_growth(2))

Andrea Arcangeli andrea at suse.de
Thu Dec 29 13:02:12 CET 2005


On Thu, Dec 29, 2005 at 04:22:35AM -0500, Bob Ippolito wrote:
> In this particular case, you might be better off just writing some  
> Twisted code that periodically checks the size of the current process  
> and does a gc.collect() when necessary.  Of course, it requires some  
> platform specific code, but presumably you only care about one, maybe  
> two, platforms anyway.

In function of time != in function of size. The timer may trigger too
late. And anyway the point was to do it in autopilot mode, I already
fixed my app with a gc.collect() after releasing the huge piece of
memory. I'll try to write a testcase for it, that if python would be
doing what I suggest, wouldn't push a system into heavy swap.


More information about the Python-Dev mailing list