PyApache memory leak?

Gregory Trubetskoy grisha at ispol.com
Thu Apr 27 08:48:12 EDT 2000


On Fri, 21 Apr 2000, Oleg Broytmann wrote:

>    This don't help saving memory. Other way round - PyApache destroys
> subinterpreter after processing a request, thus saving memory; but httpdapy
> keeps the interpreter with all (unneccessary and superfluos) imported
> modules, thus leaking memory.

I wouldn't call this "leaking". "Leaking" means forgetting to free memory
where you should be freeing it (like overlooking a Py_DECREF), loosing a
pointer to memory, etc. To the best of my knowledge, httpdapy 1.7b does
not leak memory. I've done a lot of work to make sure of this.

Another note to consider - I am not 100% sure that Py_EndInterpreter()
actually frees all memory. In fact I'm almost sure it doesn't, and you
still need to watch your reference counts if you create object via the
C-API. If that is the case, then PyApache has a higher likelyhood of
actually leaking memory.

BTW, if I remember it correctly, the decision by Lele (the author of
PyApache) to recreate the interpreter was based not on memory usage, but
because the CGI wouldn't work as expected otherwise and for security
reasons.

Grisha




More information about the Python-list mailing list