[issue2862] cleanup of freelist management
Andrew I MacIntyre
report at bugs.python.org
Thu May 15 15:46:21 CEST 2008
New submission from Andrew I MacIntyre <aimacintyre at users.sourceforge.net>:
In r60567, support for compacting the int & float freelists was added
with a function in the sys module to call the compaction routines.
Since then, other freelist clearing routines have been added to other
types and are called from the collect() function in the gc module.
The attached patch harmonises the in/float freelist compaction with the
other freelist clearing mechanisms. It does away with the function in
the sys module in favour of running the freelist clearing from gc.collect().
The signatures of the type specific freelist clearing routines have been
brought into line with the other type freelist clearing routines, with
the exception that they return the number of items _not_ free()ed,
rather than the number of items free()ed. I took this approach to try
and highlight the fact the current int/float freelist implementations
don't use pymalloc and not all items will always be free()ed when the
routine is called. This return is ignored when called from gc.collect()
in any case.
The patch includes doc updates and test updates to reflect the changes.
It has been tested on FreeBSD 6.3, surviving a default test run with no
unusual test failures as far as I can tell. It is not otherwise
The patch is against a trunk checkout that seems to be at r63156.
Ideally this patch, or similar modifications, should be applied before
the feature freeze for 2.6, so that freelist management is rationalised
to one way to do it.
components: Documentation, Interpreter Core, Tests
keywords: patch, patch
nosy: aimacintyre, christian.heimes
title: cleanup of freelist management
versions: Python 2.6
Added file: http://bugs.python.org/file10331/freelist_mgt_cleanup.patch
Tracker <report at bugs.python.org>
More information about the Python-bugs-list