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.

Title: Compact int and float freelists
Type: enhancement Stage: patch review
Components: Extension Modules, Interpreter Core Versions: Python 3.3
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: christian.heimes Nosy List: amaury.forgeotdarc, christian.heimes, nnorwitz, pitrou
Priority: normal Keywords: patch

Created on 2008-01-28 03:34 by christian.heimes, last changed 2022-04-11 14:56 by admin. This issue is now closed.

File name Uploaded Description Edit
trunk_compact_freelist.patch christian.heimes, 2008-01-28 03:34 review
trunk_compact_freelist2.patch christian.heimes, 2008-01-30 09:41 review
Messages (6)
msg61771 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2008-01-28 03:34
The patch implements gc.compact_freelists() which calls PyInt and
PyFloat_CompactFreeList(). I've moved the code from the _Fini methods to
the _CompactFreeList() methods.

The patch also moves the clear type cache function to gc.clear_type_cache().
msg61845 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2008-01-30 09:41
I've moved the methods back to the sys module and added API docs for the
C and Python code.
msg62036 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2008-02-04 06:31
I think sys is appropriate for clearing the cache.  Lib/test/
still has a reference to gc rather than sys.

Why do the CompactFreeList APIs return an int that is always 0?  Seems
like they should return a real value or be void.

I'm not sure why you changed the functions to keep a block_list_length.
 I doubt this API would be requested very often.  Seems like it would be
better to just calculate when necessary (or perhaps not even add the APIs).

The only issue I have with the patch is the casting in the printf calls.
 These can lose information.  On Win64, long is 32-bits, but size_t is
64-bits.  See PY_FORMAT_SIZE_T in Include/pyport.h for how to handle this.
msg116938 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-09-20 14:03
I've set the stage to patch review becasue I think this reflects the accepted resolution.  I don't understand why this hasn't been committed, anyone?
msg116982 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2010-09-20 21:40
The remarks above haven't been addressed. The feature is OK, but the patch is not yet perfect.
msg150275 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-12-27 21:50
I don't know what the purpose of this feature is nor who the target users are. Trying to micro-manage the interpreter's resource allocation from Python code is certainly a losing battle, and does not warrant relying on implementation-specific APIs. Moreover, these days gc.collect() implicitly collects the freelists.

I therefore recommend rejecting this patch.
Date User Action Args
2022-04-11 14:56:30adminsetgithub: 46245
2013-11-11 11:56:09ncoghlanunlinkissue19347 dependencies
2013-11-11 11:55:38ncoghlanlinkissue19347 dependencies
2013-06-24 13:28:09christian.heimessetstatus: open -> closed
2011-12-27 21:50:45pitrousetresolution: accepted -> rejected

messages: + msg150275
nosy: + pitrou
2011-12-24 18:58:48ezio.melottisetnosy: - BreamoreBoy

versions: + Python 3.3, - Python 3.2
2010-09-20 21:40:13amaury.forgeotdarcsetnosy: + amaury.forgeotdarc
messages: + msg116982
2010-09-20 14:03:40BreamoreBoysetnosy: + BreamoreBoy

messages: + msg116938
stage: patch review
2010-07-10 05:34:16terry.reedysetversions: + Python 3.2, - Python 2.6, Python 3.0
2008-02-04 06:31:36nnorwitzsetassignee: nnorwitz -> christian.heimes
resolution: accepted
messages: + msg62036
2008-01-30 09:41:33christian.heimessetfiles: + trunk_compact_freelist2.patch
messages: + msg61845
title: gc.compact_freelists -> Compact int and float freelists
2008-01-28 03:34:29christian.heimescreate