[Twisted-Python] How to explicitly free memory in twisted daemon process
andrew at bemusement.org
Mon Sep 26 20:01:32 EDT 2011
On Tue, Sep 27, 2011 at 07:48:20AM +0800, Don Li wrote:
> I have facing a problem:
> "According to the Python memory pool mechanism, the memory usage will take
> up more and more in a long-running daemon process.
> "In the long sustained logon and logout logic by a lot of users , Twisted
> process MUST stop restarting because the memory usage."
Where are you quoting that problem from?
The short answer is that if your code doesn't leak, you probably have nothing to
It's true enough that CPython's memory consumption will tend to grow over time
in a long-running daemon — but probably not unbounded, unless your code has a
leak. If there's no leak, you'd expect memory consumption grow asymptotically
to some upper bound, i.e. the memory usage will grow more and more slowly.
Are you actually experiencing a problem, or just trying to anticipate one?
Either way, actual data is good: you know that meliae reports no leaks, so what
does the OS report for memory consumption over time? Are you doing anything to
try reproduce unwanted memory usage (e.g. running load tests against your
More information about the Twisted-Python