python slowdown after a longish time of running (garbage collector)

Mahesh Padmanabhan news at
Sun Sep 1 02:49:29 CEST 2002

Thomas Jensen <spam at> writes:

> Michal Vitecek wrote:
>>  okay, thank you. it'll be pretty hard to describe it so much in detail,
>>  but here it goes:
>>     - the server waits on named socket and accepts clients' requests
>> via
>>       via stream where each command is a cPickled tuple (command,
>>       commandData,)
> Do you close the sockets manually or rely on the GC?
> I had a similiar problem recently when stress-testing a web-application.
> The GC apparently never got around to collecting the sockets, which
> resultet in lots of open sockets.
> I don't even know if the GC is supposed to handle sockets, but why not?
> Anyway, explicitly .close()'ing the sockets is probably always a good idea.

I don't know how GC is implemented in Python, but GC by its very
can only guarantee that it will close the socket eventually - it
cannot guarantee *when*.

Mahesh Padmanabhan


Replace nospam with prana to email me.

More information about the Python-list mailing list