Issue 1953: Compact int and float freelists (original) (raw)

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

Files
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/regrtest.py 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.
History
Date User Action Args
2022-04-11 14:56:30 admin set github: 46245
2013-11-11 11:56:09 ncoghlan unlink issue19347 dependencies
2013-11-11 11:55:38 ncoghlan link issue19347 dependencies
2013-06-24 13:28:09 christian.heimes set status: open -> closed
2011-12-27 21:50:45 pitrou set resolution: accepted -> rejectedmessages: + nosy: + pitrou
2011-12-24 18:58:48 ezio.melotti set nosy: - BreamoreBoyversions: + Python 3.3, - Python 3.2
2010-09-20 21:40:13 amaury.forgeotdarc set nosy: + amaury.forgeotdarcmessages: +
2010-09-20 14:03:40 BreamoreBoy set nosy: + BreamoreBoymessages: + stage: patch review
2010-07-10 05:34:16 terry.reedy set versions: + Python 3.2, - Python 2.6, Python 3.0
2008-02-04 06:31:36 nnorwitz set assignee: nnorwitz -> christian.heimesresolution: acceptedmessages: +
2008-01-30 09:41:33 christian.heimes set files: + trunk_compact_freelist2.patchmessages: + title: gc.compact_freelists -> Compact int and float freelists
2008-01-28 03:34:29 christian.heimes create