cpython/Python
Neil Schemenauer 5c16f699d2
Some checks failed
Lint / lint (push) Has been cancelled
Tests / Change detection (push) Has been cancelled
Tests / (push) Has been cancelled
Tests / Windows MSI (push) Has been cancelled
Tests / Docs (push) Has been cancelled
Tests / Check if the ABI has changed (push) Has been cancelled
Tests / Check if Autoconf files are up to date (push) Has been cancelled
Tests / Check if generated files are up to date (push) Has been cancelled
Tests / Ubuntu SSL tests with OpenSSL (push) Has been cancelled
Tests / WASI (push) Has been cancelled
Tests / Hypothesis tests on Ubuntu (push) Has been cancelled
Tests / Address sanitizer (push) Has been cancelled
Tests / CIFuzz (push) Has been cancelled
Tests / All required checks pass (push) Has been cancelled
[3.13] GH-133136: Revise QSBR to reduce excess memory held (gh-135473) (gh-136480)
The free threading build uses QSBR to delay the freeing of dictionary
keys and list arrays when the objects are accessed by multiple threads
in order to allow concurrent reads to proceed with holding the object
lock. The requests are processed in batches to reduce execution
overhead, but for large memory blocks this can lead to excess memory
usage.

Take into account the size of the memory block when deciding when to
process QSBR requests.

Also track the amount of memory being held by QSBR for mimalloc pages.
Advance the write sequence if this memory exceeds a limit.  Advancing
the sequence will allow it to be freed more quickly.

Process the held QSBR items from the "eval breaker", rather than from
`_PyMem_FreeDelayed()`.  This gives a higher chance that the global read
sequence has advanced enough so that items can be freed.

(cherry picked from commit 113de8545f)

Co-authored-by: Neil Schemenauer <nas-github@arctrix.com>
Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-07-30 11:06:44 -07:00
..
clinic [3.13] gh-113993: Allow interned strings to be mortal, and fix related issues (GH-120520) (GH-120945) 2024-06-24 20:24:19 +02:00
frozen_modules
_warnings.c [3.13] gh-131927: Prevent emitting compiler warnings twice (GH-131993) (GH-132463) 2025-04-13 08:42:04 +00:00
adaptive.md
asdl.c
asm_trampoline.S [3.13] gh-136541: Fix several problems of perf trampolines in x86_64 and aarch64 (GH-136500) (#136545) 2025-07-11 14:02:19 +00:00
assemble.c [3.13] gh-130775: Allow negative locations in ast (GH-130795) (#132243) 2025-04-08 10:47:24 +02:00
ast.c gh-116126: Implement PEP 696 (#116129) 2024-05-03 06:17:32 -07:00
ast_opt.c [3.13] gh-123344: Add missing ast optimizations for PEP 696 (GH-123377) (#123427) 2024-08-28 14:02:34 +00:00
ast_unparse.c [3.13] gh-125268: Use static string for "1e309" in AST (GH-125272) (GH-125280) 2024-10-24 13:59:23 -04:00
bltinmodule.c [3.13] gh-130070: Fix exec(<string>, closure=<non-None>) unexpected path (GH-130071) (#132627) 2025-04-17 09:21:56 +00:00
bootstrap_hash.c
brc.c gh-110481: Fix biased reference counting queue initialization. (#117271) 2024-03-28 09:28:39 -04:00
bytecodes.c [3.13] gh-133441: Fix STORE_ATTR_WITH_HINT bytecode (#133446) 2025-05-11 23:10:04 +02:00
ceval.c [3.13] GH-127953: Make line number lookup O(1) regardless of the size of the code object (#129127) 2025-04-07 20:15:02 +02:00
ceval_gil.c [3.13] GH-133136: Revise QSBR to reduce excess memory held (gh-135473) (gh-136480) 2025-07-30 11:06:44 -07:00
ceval_macros.h [3.13] gh-117657: Avoid race in PAUSE_ADAPTIVE_COUNTER in free-threaded build (GH-122190) (#122475) 2024-07-30 18:18:25 +00:00
codecs.c [3.13] gh-113993: Allow interned strings to be mortal, and fix related issues (GH-120520) (GH-120945) 2024-06-24 20:24:19 +02:00
compile.c [3.13] GH-135171: Roll back all fixes for GH-127682 as they are not suitable for 3.13 (#135390) 2025-06-11 16:57:35 +02:00
condvar.h gh-104530: Enable native Win32 condition variables by default (GH-104531) 2024-02-02 13:50:51 +00:00
config_common.h gh-76785: Add PyInterpreterConfig Helpers (gh-117170) 2024-04-02 20:35:52 +00:00
context.c [3.13] gh-132002: Fix crash of ContextVar on unhashable str subtype (GH-132003) (#132007) 2025-04-02 12:15:44 +00:00
critical_section.c [3.13] gh-119344: Make critical section API public (GH-119353) (#120856) 2024-06-21 20:20:41 +00:00
crossinterp.c [3.13] gh-135855: Raise TypeError When Passing Non-dict Object to _interpreters.set___main___attrs (gh-135903) 2025-06-24 16:23:26 -06:00
crossinterp_data_lookup.h gh-76785: Improved Subinterpreters Compatibility with 3.12 (gh-115424) 2024-02-13 14:56:49 -07:00
crossinterp_exceptions.h [3.13] gh-117398: Use Per-Interpreter State for the _datetime Static Types (gh-120009) 2024-06-03 23:37:28 +00:00
dtoa.c gh-91565: Replace bugs.python.org links with Devguide/GitHub ones (GH-91568) 2024-04-01 13:02:07 +00:00
dup2.c
dynamic_annotations.c
dynload_hpux.c
dynload_shlib.c
dynload_stub.c
dynload_win.c
emscripten_signal.c
emscripten_trampoline.c [3.13] gh-121698 Emscripten: Use updated WebAssembly type reflection proposal (GH-121699) (GH-121745) 2024-07-14 12:01:03 +02:00
errors.c [3.13] gh-130163: Fix crashes related to PySys_GetObject() (GH-130503) (GH-130556) 2025-02-25 22:50:26 +00:00
executor_cases.c.h [3.13] gh-131998: Fix NULL dereference when using an unbound method descriptor in a specialized code path (GH-132000) (#132262) 2025-04-08 11:02:29 +00:00
fileutils.c [3.13] gh-124476: Fix decoding from the locale encoding in the C.UTF-8 locale (GH-132477) (ПР-132528) 2025-04-14 18:59:07 +00:00
flowgraph.c [3.13] gh-130740: Move some stdbool.h includes after Python.h (#130738) (#130756) 2025-03-03 13:09:59 +01:00
formatter_unicode.c
frame.c gh-118272: set stacktop to 0 before freeing contents, to avoid access to invalid objects during GC (#118478) 2024-05-01 21:51:40 +01:00
frozen.c gh-108716: Cleanup remaining deepfreeze infrastructure (#116919) 2024-03-18 11:13:11 -07:00
frozenmain.c gh-105716: Fix _PyInterpreterState_IsRunningMain() For Embedders (gh-117140) 2024-03-21 18:20:20 -06:00
future.c [3.13] gh-126139: Improve error message location for future statement with unknown feature (GH-126140) (#126155) 2024-10-30 00:36:06 +00:00
gc.c [3.13] gh-131740: Update PyUnstable_GC_VisitObjects to traverse perm … (gh-131754) 2025-03-27 02:43:16 +09:00
gc_free_threading.c [3.13] gh-129533: Update PyGC_Enable/Disable/IsEnabled to use atomic operat… (gh-129756) 2025-02-06 23:11:17 +00:00
gc_gil.c gh-111968: Rename freelist related struct names to Eric's suggestion (gh-115329) 2024-02-14 00:32:51 +00:00
generated_cases.c.h [3.13] gh-133441: Fix STORE_ATTR_WITH_HINT bytecode (#133446) 2025-05-11 23:10:04 +02:00
getargs.c [3.13] gh-118814: Fix the TypeVar constructor when name is passed by keyword (GH-122664) (GH-122806) 2024-08-08 09:49:21 +03:00
getcompiler.c
getcopyright.c Update copyright years to 2024. (GH-113608) 2024-01-16 21:54:05 +01:00
getopt.c
getplatform.c
getversion.c [3.13] gh-119132: Update sys.version to identify free-threaded or not. (gh-119134) (#119153) 2024-05-18 16:49:11 -04:00
hamt.c
hashtable.c gh-111545: Add Py_HashPointer() function (#112096) 2023-12-06 15:09:22 +01:00
import.c [3.13] gh-134100: Fix use-after-free in PyImport_ImportModuleLevelObject (GH-134117) (#134172) 2025-05-18 20:38:28 +05:30
importdl.c [3.13] gh-122907: Fix Builds Without HAVE_DYNAMIC_LOADING Set (gh-122952) (#122984) 2024-12-03 16:46:30 +00:00
initconfig.c [3.13] gh-131818: Add imply -P in -I's help message (GH-131819) (#131822) 2025-03-28 08:13:00 +00:00
instruction_sequence.c [3.13] gh-130740: Move some stdbool.h includes after Python.h (#130738) (#130756) 2025-03-03 13:09:59 +01:00
instrumentation.c [3.13] gh-134411: assert PyLong_FromLong(x) != NULL when x is known to be small (GH-134415) (#136911) 2025-07-21 09:21:30 +00:00
interpconfig.c gh-76785: Fix a Refleak in _interpreters.new_config() (gh-117491) 2024-04-03 01:10:26 +00:00
intrinsics.c [3.13] gh-130163: Fix crashes related to PySys_GetObject() (GH-130503) (GH-130556) 2025-02-25 22:50:26 +00:00
jit.c [3.13] GH-118844: Fix build failures when combining --disable-gil with --enable-experimental-jit (GH-118959) 2024-05-13 04:53:30 +00:00
legacy_tracing.c [3.13] gh-117657: Fix TSAN data race in _PyEval_SetTrace assertion (gh-131561) (#131564) 2025-03-21 18:48:40 +00:00
lock.c [3.13] gh-135871: Fix needless spinning in _PyMutex_LockTimed with zero timeout (gh-135872) (gh-135947) 2025-06-25 17:09:17 +00:00
marshal.c [3.13] gh-121905: Consistently use "floating-point" instead of "floating point" (GH-121907) (GH-122012) 2024-07-19 09:13:08 +00:00
modsupport.c [3.13] gh-132909: handle overflow for 'K' format in do_mkvalue (GH-132911) (#132932) 2025-04-25 12:44:53 +00:00
mysnprintf.c
mystrtoul.c
object_stack.c gh-111968: Split _Py_dictkeys_freelist out of _Py_dict_freelist (gh-115505) 2024-02-16 01:01:36 +00:00
opcode_targets.h GH-118095: Use broader specializations of CALL in tier 1, for better tier 2 support of calls. (GH-118322) 2024-05-04 12:11:11 +01:00
optimizer.c [3.13] gh-120642: Move private PyCode APIs to the internal C API (#120643) (#121043) 2024-06-26 15:35:19 +02:00
optimizer_analysis.c [3.13] gh-120642: Move private PyCode APIs to the internal C API (#120643) (#121043) 2024-06-26 15:35:19 +02:00
optimizer_bytecodes.c [3.13] gh-119258: Backport optimizer frame fixes in GH-119365 (GH-120699) 2024-06-20 23:55:20 +08:00
optimizer_cases.c.h [3.13] gh-119258: Backport optimizer frame fixes in GH-119365 (GH-120699) 2024-06-20 23:55:20 +08:00
optimizer_symbols.c [3.13] gh-120642: Move private PyCode APIs to the internal C API (#120643) (#121043) 2024-06-26 15:35:19 +02:00
parking_lot.c [3.13] gh-112804: Clamping timeout value for _PySemaphore_PlatformWait (gh-124914) (gh-124991) 2024-10-07 16:53:32 +00:00
pathconfig.c gh-117987: Restore several functions removed in Python 3.13 alpha 1 (GH-117993) 2024-04-18 15:20:38 +02:00
perf_jit_trampoline.c [3.13] gh-136541: Fix several problems of perf trampolines in x86_64 and aarch64 (GH-136500) (#136545) 2025-07-11 14:02:19 +00:00
perf_trampoline.c [3.13] gh-136541: Fix several problems of perf trampolines in x86_64 and aarch64 (GH-136500) (#136545) 2025-07-11 14:02:19 +00:00
preconfig.c
pyarena.c
pyctype.c
pyfpe.c
pyhash.c [3.13] gh-111389: Add PyHASH_MULTIPLIER constant (GH-119214) (#119334) 2024-06-04 09:26:25 +02:00
pylifecycle.c [3.13] gh-109700: fix interpreter finalization while handling memory error (GH-136342) (#136353) 2025-07-07 07:37:35 +00:00
pymath.c
pystate.c [3.13] gh-131988: Fix a multithreaded scaling regression (#131989) 2025-04-07 20:13:02 +02:00
pystrcmp.c
pystrhex.c
pystrtod.c
Python-ast.c [3.13] gh-126105: Fix crash in ast module, when ._fields is deleted (GH-126115) (#126130) 2024-10-29 16:07:32 +00:00
Python-tokenize.c [3.13] gh-120317: Lock around global state in the tokenize module (GH-120318) (#121841) 2024-07-16 10:03:47 +00:00
pythonrun.c [3.13] gh-117174: Add a new route in linecache to fetch interactive source code (GH-117500) (#131060) 2025-03-10 23:11:24 +00:00
pytime.c gh-110850: Remove _PyTime_TimeUnchecked() function (#118552) 2024-05-05 12:15:19 +02:00
qsbr.c [3.13] GH-133136: Revise QSBR to reduce excess memory held (gh-135473) (gh-136480) 2025-07-30 11:06:44 -07:00
README
specialize.c [3.13] gh-125610: Fix STORE_ATTR_INSTANCE_VALUE specialization check (GH-125612) (GH-127698) 2024-12-06 16:14:26 +00:00
stdlib_module_names.h [3.13] gh-126925: Modify how iOS test results are gathered (GH-127592) (#127754) 2024-12-09 14:39:11 +08:00
structmember.c [3.13] gh-117657: Fix __slots__ thread safety in free-threaded build (GH-119368) (#120655) 2024-06-17 19:12:25 +00:00
suggestions.c gh-113845: Fix a compiler warning in Python/suggestions.c (GH-113949) 2024-01-11 20:31:24 +02:00
symtable.c [3.13] gh-128632: fix segfault on nested __classdict__ type param (GH-128744) (#132085) 2025-04-04 08:23:40 -07:00
sysmodule.c gh-133597: Fix memory leak if error occurred in _sys_getwindowsversion_from_kernel32 (GH-133598) 2025-05-08 11:32:59 +00:00
thread.c gh-110850: Cleanup PyTime API: PyTime_t are nanoseconds (#115753) 2024-02-21 11:46:00 +01:00
thread_nt.h gh-110850: Use _PyDeadline_Get() in EnterNonRecursiveMutex() (#118556) 2024-05-04 09:39:58 +02:00
thread_pthread.h [3.13] gh-130115: fix thread identifiers for 32-bit musl (GH-130391) (GH-132089) 2025-04-04 22:57:35 +02:00
thread_pthread_stubs.h
tier2_engine.md Docs: fix spelling of the word 'transferring' (#116641) 2024-03-13 23:53:32 +01:00
traceback.c [3.13] gh-130163: Fix crashes related to PySys_GetObject() (GH-130503) (GH-130556) 2025-02-25 22:50:26 +00:00
tracemalloc.c [3.13] gh-128679: Clear the ref tracer in _PyTraceMalloc_Stop() (#129258) 2025-01-24 14:54:02 +01:00
vm-state.md

Miscellaneous source files for the main Python shared library