cpython/Objects
Neil Schemenauer 113de8545f
GH-133136: Revise QSBR to reduce excess memory held (gh-135473)
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.

Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-06-25 00:06:32 -07:00
..
clinic gh-132661: Implement PEP 750 (#132662) 2025-04-30 11:46:41 +02:00
mimalloc gh-123826: Fix unused function warnings in mimalloc on NetBSD (#123827) 2024-09-09 13:22:28 -04:00
stringlib gh-111178: remove redundant casts for functions with correct signatures (#131673) 2025-04-01 17:18:11 +02:00
abstract.c gh-131238: Remove includes from pycore_interp.h (#131495) 2025-03-20 11:35:23 +00:00
boolobject.c gh-111178: remove redundant casts for functions with correct signatures (#131673) 2025-04-01 17:18:11 +02:00
bytearrayobject.c gh-111178: remove redundant casts for functions with correct signatures (#131673) 2025-04-01 17:18:11 +02:00
bytes_methods.c gh-121165: protect macro expansion of ADJUST_INDICES with do-while(0) (#121166) 2024-07-02 16:27:51 +05:30
bytesobject.c gh-133767: Fix use-after-free in the unicode-escape decoder with an error handler (GH-129648) 2025-05-12 20:42:23 +03:00
call.c gh-134043: use stackrefs in vectorcalling methods (#134044) 2025-05-27 22:28:27 +05:30
capsule.c gh-111178: fix UBSan failures in Objects/capsule.c (GH-128239) 2025-01-08 14:55:04 +01:00
cellobject.c gh-127271: Replace use of PyCell_GET/SET (gh-127272) 2024-12-03 10:33:06 -08:00
classobject.c Revert "gh-124715: Fix method_dealloc(): use PyObject_GC_UnTrack() (#133199)" (#133434) 2025-05-05 17:04:43 +02:00
codeobject.c GH-133136: Revise QSBR to reduce excess memory held (gh-135473) 2025-06-25 00:06:32 -07:00
complexobject.c gh-126703: Add freelist for PyComplexObject's (gh-135233) 2025-06-13 22:32:26 +09:00
descrobject.c GH-124715: Move trashcan mechanism into Py_Dealloc (GH-132280) 2025-04-30 11:37:53 +01:00
dictnotes.txt bpo-46845: Reduce dict size when all keys are Unicode (GH-31564) 2022-03-02 08:09:28 +09:00
dictobject.c GH-133136: Revise QSBR to reduce excess memory held (gh-135473) 2025-06-25 00:06:32 -07:00
enumobject.c gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
exceptions.c GH-124715: Move trashcan mechanism into Py_Dealloc (GH-132280) 2025-04-30 11:37:53 +01:00
fileobject.c gh-111178: fix UBSan failures for PyStdPrinter_Object (#131607) 2025-03-24 10:57:14 +01:00
floatobject.c gh-133304: workaround for RISC-V in PyFloat_Pack4/Unpack4() (#133328) 2025-05-03 17:07:52 +02:00
frameobject.c GH-132554: "Virtual" iterators (GH-132555) 2025-05-27 15:59:45 +01:00
funcobject.c gh-132775: Fix _PyFunctIon_VerifyStateless() (#134900) 2025-05-29 20:13:12 +00:00
genericaliasobject.c gh-133968: Add PyUnicodeWriter_WriteASCII() function (#133973) 2025-05-29 14:54:30 +00:00
genobject.c gh-133931: Introduce _PyObject_XSetRefDelayed to replace Py_XSETREF (gh-134377) 2025-06-18 08:36:02 +09:00
interpolationobject.c gh-133970: Make PEP750 types generic (#133976) 2025-05-15 09:11:46 +03:00
iterobject.c gh-131666: mark anext_awaitable.close as a METH_NOARGS instead of METH_VARARGS (#131671) 2025-03-25 09:03:22 +05:30
listobject.c GH-133136: Revise QSBR to reduce excess memory held (gh-135473) 2025-06-25 00:06:32 -07:00
listsort.txt GH-116939: Rewrite binarysort() (#116940) 2024-03-21 22:27:25 -05:00
lnotab_notes.txt gh-119786: add code object doc, inline locations.md into it (#126832) 2024-11-22 19:27:41 +00:00
longobject.c gh-135379: fix MSVC warning: conversion from 'stwodigits' to 'digit' (GH-135714) 2025-06-20 17:05:33 +08:00
memoryobject.c gh-132776: Revert Moving memoryview XIData Code to memoryobject.c (gh-132960) 2025-04-25 16:43:50 +00:00
methodobject.c GH-124715: Move trashcan mechanism into Py_Dealloc (GH-132280) 2025-04-30 11:37:53 +01:00
moduleobject.c gh-108512: Add and use new replacements for PySys_GetObject() (GH-111035) 2025-05-28 20:11:09 +03:00
namespaceobject.c gh-135878: Fix crash in types.SimpleNamespace.__repr__ (#135889) 2025-06-24 19:33:25 +03:00
object.c GH-135106: Restrict trashcan to GC'ed objects (GH-135682) 2025-06-24 09:49:38 +01:00
object_layout.md GH-115776: Allow any fixed sized object to have inline values (GH-123192) 2024-08-21 15:52:04 +01:00
object_layout_312.gv GH-115776: Embed the values array into the object, for "normal" Python objects. (GH-116115) 2024-04-02 11:59:21 +01:00
object_layout_312.png GH-115776: Embed the values array into the object, for "normal" Python objects. (GH-116115) 2024-04-02 11:59:21 +01:00
object_layout_313.gv GH-115776: Embed the values array into the object, for "normal" Python objects. (GH-116115) 2024-04-02 11:59:21 +01:00
object_layout_313.png GH-115776: Embed the values array into the object, for "normal" Python objects. (GH-116115) 2024-04-02 11:59:21 +01:00
object_layout_full_312.gv GH-96068: Document object layout (GH-96069) 2022-08-23 13:55:43 +01:00
object_layout_full_312.png GH-96068: Document object layout (GH-96069) 2022-08-23 13:55:43 +01:00
object_layout_full_313.gv GH-115776: Embed the values array into the object, for "normal" Python objects. (GH-116115) 2024-04-02 11:59:21 +01:00
object_layout_full_313.png GH-115776: Embed the values array into the object, for "normal" Python objects. (GH-116115) 2024-04-02 11:59:21 +01:00
obmalloc.c GH-133136: Revise QSBR to reduce excess memory held (gh-135473) 2025-06-25 00:06:32 -07:00
odictobject.c GH-124715: Move trashcan mechanism into Py_Dealloc (GH-132280) 2025-04-30 11:37:53 +01:00
picklebufobject.c gh-111178: Fix function signatures for multiple tests (#131496) 2025-03-20 12:27:03 +01:00
rangeobject.c gh-126703: Add freelist for range and range_iter objects (GH-128619) 2025-04-07 04:40:52 +08:00
README
setobject.c GH-124715: Move trashcan mechanism into Py_Dealloc (GH-132280) 2025-04-30 11:37:53 +01:00
sliceobject.c gh-111178: Fix function signatures for multiple tests (#131496) 2025-03-20 12:27:03 +01:00
structseq.c gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
templateobject.c gh-134119: Fix crash from calling next() on exhausted template iterator (#134120) 2025-05-17 12:23:19 -07:00
tupleobject.c GH-124715: Move trashcan mechanism into Py_Dealloc (GH-132280) 2025-04-30 11:37:53 +01:00
typeobject.c gh-133931: Introduce _PyObject_XSetRefDelayed to replace Py_XSETREF (gh-134377) 2025-06-18 08:36:02 +09:00
typeslots.inc Revert "gh-133395: add option for extension modules to specialize BINARY_OP/SUBSCR, apply to arrays (#133396)" (#133498) 2025-05-06 13:12:26 +03:00
typeslots.py gh-124153: Implement PyType_GetBaseByToken() and Py_tp_token slot (GH-124163) 2024-09-18 09:18:19 +02:00
typevarobject.c gh-133968: Add PyUnicodeWriter_WriteASCII() function (#133973) 2025-05-29 14:54:30 +00:00
unicodectype.c gh-82045: Correct and deduplicate "isprintable" docs; add test. (GH-130118) 2025-02-14 18:16:47 +01:00
unicodeobject.c gh-134891: Add PyUnstable_Unicode_GET_CACHED_HASH (GH-134892) 2025-06-06 15:51:00 +02:00
unicodetype_db.h closes gh-124016: update Unicode to 16.0.0 (#124017) 2024-09-13 07:47:04 -07:00
unionobject.c gh-133968: Add PyUnicodeWriter_WriteASCII() function (#133973) 2025-05-29 14:54:30 +00:00
weakrefobject.c gh-129354: Use PyErr_FormatUnraisable() function (#129511) 2025-01-31 13:16:08 +01:00

Source files for various builtin objects