[Twisted-Python] twisted eat the memory

Andreas Kostyrka andreas at kostyrka.org
Mon Dec 15 14:39:48 EST 2008


Am Mon, 15 Dec 2008 20:31:39 +0300
schrieb "Muaaz Hussain" <muaazhussain128 at gmail.com>:

> I wrote web application on twisted and my application read from ulogd
> daemon and push the output to the client browser using AJAX  .also I
> have another application displaying ethernets traffic using AJAX.
> but after some minutes the twisted process in the server eat the
> memory and the OOM-killer of the linux will kill the twisted process.
> are there any solution to make the twisted release the memory .
> 
> note: my ram is 256mb
> 

Well, CPython uses a dual garbage collection policy (reference
counting, and cycle breaking GC), and there are at least some cases
where garbage can leak. (cycles with __del__ methods defined.)

But in a different way, that only helps you manage memory, but in the
end you as the developer need to decide which objects you still need
to forget about the object before Python can release the memory.

Another point is that under Unix, processes tend to keep memory they
have allocated to themselves, so if your process needs say 300MB at
start-up and releases 270MB you need to check if these really end up
available for the OS.

But as exarkun pointed out, that's a nontrivial problem, and without
reducing it to a small and runnable example that shows your problem,
the list won't be able to help you much. (If you have such general
python questions, you might consider posting also to tutor at python.org,
which tends to be slightly more considerate to newbies.)

Andreas
 




More information about the Twisted-Python mailing list