[Twisted-Python] How to explicitly free memory in twisted daemon process

Andrew Bennetts andrew at bemusement.org
Mon Sep 26 18:01:32 MDT 2011


On Tue, Sep 27, 2011 at 07:48:20AM +0800, Don Li wrote:
> Hi,
> 
> 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
worry about.

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
daemon)?

-Andrew.





More information about the Twisted-Python mailing list