python 3.0 memory leaking?
lists at cheimes.de
Sun Feb 10 21:24:43 CET 2008
Jeroen Ruigrok van der Werven wrote:
> For me, a relative newbie to Python, the entire memory allocation issue is
> not transparent at all and information about it is scattered across the net.
> One of the things I hope to contribute to in the coming year is to make sure
> the entire area of Python memory use and proper coding is better understood.
Python uses its own memory allocator for small objecst (< 257 bytes).
Larger objects are allocated directly with malloc, smaller objects end
up in arenas. The code is well documented in
Several objects keep a free list for performance reasons. Free list save
some extra mallocs and initialization of data structures. I've renamed
all free lists in Python 2.6 to "free_list".
Ints and floats are using their own block allocation algorithm. The code
predates Python's pymalloc code. I'm working on replacing the code with
pymalloc because pymalloc-ed memory is given back to the OS. The int
and float free lists keep their sizes until the Python process ends.
More information about the Python-list