magic memory leak, Python or Windows problem?
"Martin v. Löwis"
martin at v.loewis.de
Fri May 2 06:02:18 EDT 2003
Marcus Stojek wrote:
> Can anybody explain this? Is this a problem of Pyhon or of what the
> Task Manager shows (or maybe of my brain)?
Most likely, this is a problem of your brain. If a Python object is
released, the memory may or may not be given back to the C library - in
some cases, Python caches the deleted objects, in order to reallocate
them more quickly the next time.
When Python returns memory back to the C library, it may or may not be
returned to the system. In most cases, the C library keeps blocks of
memory, in order to reallocate them more quickly on the next memory
request. The C library usually can return memory to the system only if
that is at the end of the address space - free memory in the middle of
the address space cannot be returned to the system, because the system
does not support that operation.
In general, you can assume a memory leak only if the memory is growing
unboundedly. If it grows to an upper bound and stays there, you usually
don't have a leak.
Regards,
Martin
More information about the Python-list
mailing list