[Twisted-web] Memory leak with twisted web server on QNX

denis.leborgne at rieter.com denis.leborgne at rieter.com
Fri Nov 4 08:24:12 MST 2005

thanks for help.

I did not see any difference with the new _c_urlarg moduIe. I made then 
several trials and I found that Python 2.4.1 with Twisted 1.3.0 seems to 
be stable. It now runs for several days without leak. Something a little 
bit strange is that I tried Python 2.4.1 with Twisted 2.0.1 and TwistedWeb 
0.5.0, but with this configuration the memory leak is very important. Yet 
with this config the objects number (length of gc.get_objects()) is 
growing with no collection, as I use exactly the same environment except 
Twisted version.

Can you see a reason for that ?

Andrew Bennetts <andrew-twisted at puzzling.org> 
Sent by: twisted-web-bounces at twistedmatrix.com
19/10/2005 16:05
Please respond to
"Discussion of twisted.web, Nevow,      and Woven" 
<twisted-web at twistedmatrix.com>

"Discussion of twisted.web, Nevow,      and Woven" 
<twisted-web at twistedmatrix.com>

Re: [Twisted-web] Memory leak with twisted web server on QNX

Security Level:?        Internal
On Wed, Oct 19, 2005 at 10:15:24AM +0200, denis.leborgne at rieter.com wrote:
> Hi,
> I use twisted as a very simple web server to serve python scripts. I now 
have a
> problem of memory leak on the server. I use Python 2.2.1 on QNX 6.3, 
> version is 1.3.0.
> About every 4 "refresh", the memory used by my server increases by 96k, 
> nor release of memory. I checked the object number by watching len
> (gc.get_objects()), but it is stable.
> Any idea to help me to solve this problem, my server is expected to run
> continuously.

There was a leak in the _c_urlarg.c module in 1.3.0, which causes a string
the size of the url to be leaked every request.  This doesn't sound like 
would account for the 96k per 4 requests to me, but perhaps the memory
allocation strategy on QNX explains that.

Either upgrade to Twisted 2.0 or newer, or grab _c_urlarg.c from that
version or SVN (it's a one-line fix) and recompile it, or just delete the
compiled module -- it'll fall back to the slower pure-python version in 
standard library, but it won't leak.

Let us know if that solves it, or at least helps.


Twisted-web mailing list
Twisted-web at twistedmatrix.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-web/attachments/20051104/eeae9d60/attachment.htm

More information about the Twisted-web mailing list