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

Andrew Bennetts andrew-twisted at puzzling.org
Wed Oct 19 08:05:30 MDT 2005


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, Twisted
> version is 1.3.0.
[...]
> About every 4 "refresh", the memory used by my server increases by 96k, with
> 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 it
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 the
standard library, but it won't leak.

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

-Andrew.




More information about the Twisted-web mailing list