Memory usage problem of twisted server

Dieter Maurer dieter at
Fri Jan 22 07:33:49 CET 2010

Victor Lin <bornstub at> writes on Wed, 20 Jan 2010 02:52:25 -0800 (PST):
> Hi,
> I encountered an increasing memory usage problem of my twisted server.
> I have posted a question on stackoverflow:
> I have read the article "Improving Python's Memory Allocator" (
> ) and Python Memory Management
> ( ). And I now know little
> about how Python manages memory. I am wondering, is that the
> increasing memory usage problem of my audio broadcasting caused by the
> how python manage memory?

Your careful reading has already told you that Python delegates
memory allocation for larger blocks (>= 256 bytes) to the underlying
C runtime library ("malloc" and friends).

The C runtime library does not use memory compaction, i.e.
it does not relocate used memory blocks in order to free space
in few large chunks. Therefore, it is sensible to memory fragmentation:
the free space gets scattered around in a large number of rather small
The fragmentation rate is especially high when the memory request sizes
have a high variance.
> ....
> Is that my guessing correct? How can I monitor the memory allocation
> of Python?

Look at ""


More information about the Python-list mailing list