[Twisted-Python] Reducing memory footprint of twisted app?

Marcin Kasperski Marcin.Kasperski at softax.com.pl
Tue Aug 15 06:36:16 EDT 2006


Not an exact question, but rather 'searching for ideas'.

I have some twisted app, which uses more memory than I would like it to.
I tried analysing it a bit (mainly using gc module object list and 
enumerating
items of different types) and it seem to me that there is something 
'twistedish'
in it. My application uses in a lot of places generator idiom 
(functions/methods
which yield wrapped with defer.deferredGenerator). And, as there seem to be
a lot of anonymous functions and tuples allocated, I suspect that maybe 
those
functions, deferreds and related params and closures live longer then I 
would like
to.

Any ideas of what could I do to track it down? In particular, is it 
possible to somehow
use introspection to find which lambdas and deferreds are allocated 
while the program
is running? Are there any suggestions on how to code deferredGenerators 
to reduce
allocated memory (maybe, for instance, I should try to turn local 
variables into
object attributes, or opposite, or ...)

Also, if anybody could me point to any interesting resources about 
tracking python
momory usage, I would be grateful.

Tried googling for some time, but apart of zope trackRef I did not found 
anything.





More information about the Twisted-Python mailing list