Skip to content

Allow to build Python without freelists #89685

Closed

Description

@tiran
BPO 45522
Nosy @vstinner, @tiran, @markshannon, @miss-islington
PRs
  • bpo-45522: Allow to disable freelists on build time #29056
  • bpo-45522: Allow to disable freelists on build time #29086
  • 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 = None
    created_at = <Date 2021-10-19.11:06:04.660>
    labels = ['expert-C-API', 'type-feature', '3.11']
    title = 'Allow to build Python without freelists'
    updated_at = <Date 2022-01-17.13:14:15.976>
    user = 'https://github.com/tiran'

    bugs.python.org fields:

    activity = <Date 2022-01-17.13:14:15.976>
    actor = 'vstinner'
    assignee = 'christian.heimes'
    closed = False
    closed_date = None
    closer = None
    components = ['C API']
    creation = <Date 2021-10-19.11:06:04.660>
    creator = 'christian.heimes'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 45522
    keywords = ['patch']
    message_count = 6.0
    messages = ['404289', '404599', '405207', '405293', '410614', '410778']
    nosy_count = 4.0
    nosy_names = ['vstinner', 'christian.heimes', 'Mark.Shannon', 'miss-islington']
    pr_nums = ['29056', '29086']
    priority = 'normal'
    resolution = None
    stage = 'resolved'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue45522'
    versions = ['Python 3.11']

    Activity

    1. tiran commented on Oct 19, 2021

      @tiran
      MemberAuthor

      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.

    2. self-assigned this
      on Oct 19, 2021
    3. self-assigned this
      on Oct 19, 2021
    4. miss-islington commented on Oct 21, 2021

      @miss-islington
      Contributor

      New changeset 9942f42 by Christian Heimes in branch 'main':
      bpo-45522: Allow to disable freelists on build time (GH-29056)
      9942f42

    5. markshannon commented on Oct 28, 2021

      @markshannon
      Member

      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.

    6. tiran commented on Oct 29, 2021

      @tiran
      MemberAuthor

      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?

    7. vstinner commented on Jan 15, 2022

      @vstinner
      Member

      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)

      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 ;-)

    8. vstinner commented on Jan 17, 2022

      @vstinner
      Member

      I reopen the issue to not forget to complete the doc.

    9. transferred this issue fromon Apr 10, 2022
    10. erlend-aasland commented on Jun 19, 2023

      @erlend-aasland
      Contributor

      I reopen the issue to not forget to complete the doc.

      I checked the docs, and this option is now documented; marking the issue as resolved.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions