]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-112532: Isolate abandoned segments by interpreter (#113717)
authorSam Gross <colesbury@gmail.com>
Thu, 4 Jan 2024 22:21:40 +0000 (17:21 -0500)
committerGitHub <noreply@github.com>
Thu, 4 Jan 2024 22:21:40 +0000 (22:21 +0000)
commitfcb3c2a444709d2a53faa20c5b43541674064018
treec0d5d58c179a2e7d5dd1c234360c6afdb8beaf42
parentc2e8298eba3f8d75a58e5b3636f8edc8d60e68da
gh-112532: Isolate abandoned segments by interpreter (#113717)

* gh-112532: Isolate abandoned segments by interpreter

Mimalloc segments are data structures that contain memory allocations along
with metadata. Each segment is "owned" by a thread. When a thread exits,
it abandons its segments to a global pool to be later reclaimed by other
threads. This changes the pool to be per-interpreter instead of process-wide.

This will be important for when we use mimalloc to find GC objects in the
`--disable-gil` builds. We want heaps to only store Python objects from a
single interpreter. Absent this change, the abandoning and reclaiming process
could break this isolation.

* Add missing '&_mi_abandoned_default' to 'tld_empty'
Include/internal/mimalloc/mimalloc/internal.h
Include/internal/mimalloc/mimalloc/types.h
Include/internal/pycore_interp.h
Include/internal/pycore_mimalloc.h
Objects/mimalloc/init.c
Objects/mimalloc/segment.c
Python/pystate.c