This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author tim.peters
Recipients
Date 2006-06-30.06:17:06
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Logged In: YES 
user_id=31435

As the NEWS entry says,

"""
Patch #1123430: Python's small-object allocator now returns
an arena to the system ``free()`` when all memory within an
arena becomes unused again.  Prior to Python 2.5, arenas
(256KB chunks of memory) were never freed.  Some
applications will see a drop in virtual memory size now,
especially long-running applications that, from time to
time, temporarily use a large number of small objects.  Note
that when Python returns an arena to the platform C's
``free()``, there's no guarantee that the platform C library
will in turn return that memory to the operating system. 
The effect of the patch is to stop making that impossible,
and in tests it appears to be effective at least on
Microsoft C and gcc-based systems.
"""

An instrumented debug build of current trunk showed that
Python eventually returned 472 of 544 allocated arenas to
the platform free() in your program, leaving 72 still
allocated when Python shut down.  The latter is due to
fragmentation, and there will never be "a cure" for that
since CPython guarantees never to move objects.  The arena
highwater mark was 240 arenas, which is what Python would
have held on to forever before the patch.

A large part of the relatively disappointing result we see
here is due to that the tuple implementation maintains its
own free lists too:  it never returns a few thousand of the
tuple objects to obmalloc before Python shuts down, and that
in turn keeps all the arenas from which those tuple objects
were originally obtained alive until Python shuts down. 
There's nothing obmalloc or gcmodule can do about that, and
the tuple free lists are _likely_ an important optimization
in real applications.
History
Date User Action Args
2007-08-23 15:41:53adminlinkissue1123430 messages
2007-08-23 15:41:53admincreate