[Numpy-discussion] python memory use

Christian Heimes lists@cheimes...
Sat May 3 07:09:43 CDT 2008


Robin schrieb:
> If I try to allocate something too big for the available memory I
> often get a MemoryError exception. However, in other situations,
> Python memory use continues to grow until the machine falls over. I
> was hoping to understand the difference between those cases. From what
> I've read Python never returns memory to the OS (is this right?) so
> the second case, python is holding on to memory that it isn't really
> using (for objects that have been destroyed). I guess my question is
> why doesn't it reuse the memory freed from object deletions instead of
> requesting more - and even then when requesting more, why does it
> continue until the machine falls over and not cause a MemoryError?

Your assumption isn't correct. Python releases memory. For small objects
Python uses its own memory allocation system as explained in
http://svn.python.org/projects/python/trunk/Objects/obmalloc.c . For
integer and floats uses a separate block allocation schema.

Christian



More information about the Numpy-discussion mailing list