You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee='https://github.com/tiran'closed_at=Nonecreated_at=<Date2021-10-19.11:06:04.660>labels= ['expert-C-API', 'type-feature', '3.11']
title='Allow to build Python without freelists'updated_at=<Date2022-01-17.13:14:15.976>user='https://github.com/tiran'
Freelists are an optimization trick to avoid allocation and deallocation of commonly used structures. Currently Python has freelists for frame, tuple, float, list, dict, async generators, and context objects. Small ints are also cached.
For experimentation with alternative memory allocators such as mimalloc, I would like to introduce a way to disable freelists. Tuples's _Py_tuple_state struct has a conditional check on #if PyTuple_MAXSAVESIZE > 0. I propose to add same logic to all other structs.
I think we should revert this. It just makes working with freelists more cumbersome. Having more configure options just makes it more likely that we will fail to test some configuration.
If you want to disable freelists in your experiments, feel free to do so, but it doesn't need to be in main, IMO.
Which part of the patch is causing you extra work? Would you be fine if I only remove the configure option and leave the fixes for zero-length freelists (#define PyList_MAXFREELIST 0) in?
Freelists for object structs can now be disabled. A new configure option --without-freelists can be used to disable all freelists except empty tuple singleton. (Contributed by Christian Heimes in bpo-45522)
Activity
tiran commentedon Oct 19, 2021
Freelists are an optimization trick to avoid allocation and deallocation of commonly used structures. Currently Python has freelists for frame, tuple, float, list, dict, async generators, and context objects. Small ints are also cached.
For experimentation with alternative memory allocators such as mimalloc, I would like to introduce a way to disable freelists. Tuples's _Py_tuple_state struct has a conditional check on #if PyTuple_MAXSAVESIZE > 0. I propose to add same logic to all other structs.
miss-islington commentedon Oct 21, 2021
New changeset 9942f42 by Christian Heimes in branch 'main':
bpo-45522: Allow to disable freelists on build time (GH-29056)
9942f42
markshannon commentedon Oct 28, 2021
I think we should revert this. It just makes working with freelists more cumbersome. Having more configure options just makes it more likely that we will fail to test some configuration.
If you want to disable freelists in your experiments, feel free to do so, but it doesn't need to be in main, IMO.
tiran commentedon Oct 29, 2021
Which part of the patch is causing you extra work? Would you be fine if I only remove the configure option and leave the fixes for zero-length freelists (#define PyList_MAXFREELIST 0) in?
vstinner commentedon Jan 15, 2022
Can you please document the new configuration option in https://docs.python.org/dev/using/configure.html ?
When you write :option:`--without-freelists` in what's new in Python 3.11 to get a link ;-)
vstinner commentedon Jan 17, 2022
I reopen the issue to not forget to complete the doc.
erlend-aasland commentedon Jun 19, 2023
I checked the docs, and this option is now documented; marking the issue as resolved.