summaryrefslogtreecommitdiffstats
path: root/Python/gc.c
Commit message (Collapse)AuthorAgeFilesLines
* GH-126491: GC: Mark objects reachable from roots before doing cycle ↵Mark Shannon2024-12-021-87/+268
| | | | | | | | | | | | | collection (GH-127110) * Mark almost all reachable objects before doing collection phase * Add stats for objects marked * Visit new frames before each increment * Update docs * Clearer calculation of work to do.
* GH-127010: Don't lazily track and untrack dicts (GH-127027)Mark Shannon2024-11-201-31/+4
|
* GH-124567: Replace quadratic assert with linear one (GH-127009)Mark Shannon2024-11-191-1/+1
|
* Revert "GH-126491: GC: Mark objects reachable from roots before doing cycle ↵Hugo van Kemenade2024-11-191-215/+62
| | | | collection (GH-126502)" (#126983)
* GH-126491: GC: Mark objects reachable from roots before doing cycle ↵Mark Shannon2024-11-181-62/+215
| | | | | | | | | | | | | | | | collection (GH-126502) * Mark almost all reachable objects before doing collection phase * Add stats for objects marked * Visit new frames before each increment * Remove lazy dict tracking * Update docs * Clearer calculation of work to do.
* GH-124567: Reduce overhead of debug build for GC. Should help CI performance ↵Mark Shannon2024-11-151-1/+9
| | | | (GH-126777)
* gh-116510: Fix crash during sub-interpreter shutdown (gh-124645)Neil Schemenauer2024-09-271-3/+26
| | | | | Fix a bug that can cause a crash when sub-interpreters use "basic" single-phase extension modules. Shared objects could refer to PyGC_Head nodes that had been freed as part of interpreter shutdown.
* gh-123923: Defer refcounting for `f_executable` in `_PyInterpreterFrame` ↵Sam Gross2024-09-121-0/+7
| | | | | | | | (#123924) Use a `_PyStackRef` and defer the reference to `f_executable` when possible. This avoids some reference count contention in the common case of executing the same code object from multiple threads concurrently in the free-threaded build.
* GH-117759: Document incremental GC (GH-123266)Mark Shannon2024-08-271-11/+16
| | | | | | * Update what's new * Update gc module docs and fix inconsistency in gc.get_objects
* GH-122298: Restore printing of GC stats (GH-123261)Mark Shannon2024-08-231-0/+25
|
* GH-115776: Allow any fixed sized object to have inline values (GH-123192)Mark Shannon2024-08-211-0/+3
|
* gh-117139: Garbage collector support for deferred refcounting (#122956)Sam Gross2024-08-151-0/+11
| | | | | | | | | | The free-threaded GC now visits interpreter stacks to keep objects that use deferred reference counting alive. Interpreter frames are zero initialized in the free-threaded GC so that the GC doesn't see garbage data. This is a temporary measure until stack spilling around escaping calls is implemented. Co-authored-by: Ken Jin <kenjin@python.org>
* gh-83754: Use the Py_TYPE() macro (#120599)Victor Stinner2024-06-171-3/+3
| | | | Don't access directly PyObject.ob_type, but use the Py_TYPE() macro instead.
* Fix typos in documentation and comments (#119763)Xie Yanbo2024-06-041-2/+2
|
* gh-110850: Remove _PyTime_TimeUnchecked() function (#118552)Victor Stinner2024-05-051-1/+0
| | | | | | | | | | | | | Use the new public Raw functions: * _PyTime_PerfCounterUnchecked() with PyTime_PerfCounterRaw() * _PyTime_TimeUnchecked() with PyTime_TimeRaw() * _PyTime_MonotonicUnchecked() with PyTime_MonotonicRaw() Remove internal functions: * _PyTime_PerfCounterUnchecked() * _PyTime_TimeUnchecked() * _PyTime_MonotonicUnchecked()
* GH-115776: Embed the values array into the object, for "normal" Python ↵Mark Shannon2024-04-021-1/+6
| | | | objects. (GH-116115)
* Silence compiler warnings in gc.c (#117422)Guido van Rossum2024-04-011-0/+3
|
* GH-117108: Set the "old space bit" to "visited" for all young objects (#117213)Mark Shannon2024-03-261-17/+37
| | | | Change old space bit of young objects from 0 to gcstate->visited_space. This ensures that any object created *and* collected during cycle GC has the bit set correctly.
* A few minor tweaks to get stats working and compiling cleanly. (#117219)Mark Shannon2024-03-251-5/+3
| | | | Fixes a compilation error when configured with `--enable-pystats`, an array size issue, and an unused variable.
* GH-117108: Change the size of the GC increment to about 1% of the total heap ↵Mark Shannon2024-03-221-15/+15
| | | | size. (GH-117120)
* GH-108362: Incremental Cycle GC (GH-116206)Mark Shannon2024-03-201-308/+498
|
* gh-116604: Correctly honor the gc status when calling _Py_RunGC (#116628)Pablo Galindo Salgado2024-03-121-0/+4
|
* gh-110850: Use public PyTime functions (#115746)Victor Stinner2024-02-201-1/+1
| | | | | Replace private _PyTime functions with public PyTime functions. random_seed_time_pid() now reports errors to its caller.
* gh-110850: Rename internal PyTime C API functions (#115734)Victor Stinner2024-02-201-3/+3
| | | | | | | | | | | | | | | | | Rename functions: * _PyTime_GetSystemClock() => _PyTime_TimeUnchecked() * _PyTime_GetPerfCounter() => _PyTime_PerfCounterUnchecked() * _PyTime_GetMonotonicClock() => _PyTime_MonotonicUnchecked() * _PyTime_GetSystemClockWithInfo() => _PyTime_TimeWithInfo() * _PyTime_GetMonotonicClockWithInfo() => _PyTime_MonotonicWithInfo() * _PyTime_GetMonotonicClockWithInfo() => _PyTime_MonotonicWithInfo() Changes: * Remove "typedef PyTime_t PyTime_t;" which was "typedef PyTime_t _PyTime_t;" before a previous rename. * Update comments of "Unchecked" functions. * Remove invalid PyTime_Time() comment.
* gh-110850: Cleanup pycore_time.h includes (#115724)Victor Stinner2024-02-201-0/+1
| | | | | <pycore_time.h> include is no longer needed to get the PyTime_t type in internal header files. This type is now provided by <Python.h> include. Add <pycore_time.h> includes to C files instead.
* gh-110850: Replace _PyTime_t with PyTime_t (#115719)Victor Stinner2024-02-201-1/+1
| | | | | Run command: sed -i -e 's!\<_PyTime_t\>!PyTime_t!g' $(find -name "*.c" -o -name "*.h")
* gh-112175: Add `eval_breaker` to `PyThreadState` (#115194)Brett Simmers2024-02-201-3/+6
| | | | | | | | | | | This change adds an `eval_breaker` field to `PyThreadState`. The primary motivation is for performance in free-threaded builds: with thread-local eval breakers, we can stop a specific thread (e.g., for an async exception) without interrupting other threads. The source of truth for the global instrumentation version is stored in the `instrumentation_version` field in PyInterpreterState. Threads usually read the version from their local `eval_breaker`, where it continues to be colocated with the eval breaker bits.
* gh-115124: Use _PyObject_ASSERT() in gc.c (#115125)Victor Stinner2024-02-151-15/+22
| | | | Replace assert() with _PyObject_ASSERT() in gc.c to dump the object when an assertion fails.
* GH-108362: Revert "GH-108362: Incremental GC implementation (GH-108038)" ↵Mark Shannon2024-02-071-514/+310
| | | | | | | (#115132) Revert "GH-108362: Incremental GC implementation (GH-108038)" This reverts commit 36518e69d74607e5f094ce55286188e4545a947d.
* GH-108362: Incremental GC implementation (GH-108038)Mark Shannon2024-02-051-310/+514
|
* gh-112529: Implement GC for free-threaded builds (#114262)Sam Gross2024-01-251-2/+6
| | | | | | | * gh-112529: Implement GC for free-threaded builds This implements a mark and sweep GC for the free-threaded builds of CPython. The implementation relies on mimalloc to find GC tracked objects (i.e., "containers").
* gh-112529: Use GC heaps for GC allocations in free-threaded builds (gh-114157)Sam Gross2024-01-201-6/+7
| | | | | | | | | | * gh-112529: Use GC heaps for GC allocations in free-threaded builds The free-threaded build's garbage collector implementation will need to find GC objects by traversing mimalloc heaps. This hooks up the allocation calls with the correct heaps by using a thread-local "current_obj_heap" variable. * Refactor out setting heap based on type
* gh-111968: Introduce _PyFreeListState and _PyFreeListState_GET API (gh-113584)Donghee Na2024-01-091-16/+1
|
* gh-113688: Split up gcmodule.c (gh-113715)Sam Gross2024-01-051-0/+1958
This splits part of Modules/gcmodule.c of into Python/gc.c, which now contains the core garbage collection implementation. The Python module remain in the Modules/gcmodule.c file.