[Python-Dev] suggestion for smarter garbage collection in function of size (gc.set_collect_mem_growth(2))
Bob Ippolito
bob at redivi.com
Thu Dec 29 10:22:35 CET 2005
On Dec 27, 2005, at 9:05 AM, Andrea Arcangeli wrote:
> I run into a problem recently with a reconnectingclientfactory with
> twisted while write some spare time software, that turned out to be
> a gc
> inefficiency.
>> In short the protocol memory wasn't released after the reconnect
> and the
> protocol had about 50M attached to it. So with frequent reconnects the
> rss of the task grown to >1G and it pushed the system into heavy swap.
> In reality only 50M were allocated, so 950M were wasted by python.
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.
-bob
More information about the Python-Dev
mailing list