Allocation/deallocation of a BIG list in Linux

Ignacio Vazquez-Abrams ignacio at openservices.net
Thu Sep 20 20:00:27 EDT 2001


When running 'python -c range\(3e7\)' under Linux, I;'e noticed something
interesting with regards to memory allocation and deallocation.

In the beginning, memory allocation is fairly constant for the first quarter
or so. After that it slows down a bit, but still climbs. Then it hits a
plateau at about 560000K, where it stays for about a second or so. Then it
drops about 115MB in a tiny fraction of a second, then trickles down to
nothing.

This behaviour is exhibited in Python 1.5.2, 2.1.1, and 2.2a3.

My questions are:

1) Why does the speed of allocation change?
2) How come there is a large drop in memory when deallocating, then a
(slightly) more gentle descent?
3) Is this exhibited on other operating systems?

**NOTE: I'm running this under 768MB of RAM, so people with less RAM should
use a smaller number in range() to test.

-- 
Ignacio Vazquez-Abrams  <ignacio at openservices.net>





More information about the Python-list mailing list