mirror of
https://github.com/python/cpython.git
synced 2025-08-31 22:18:28 +00:00
gh-112529: Implement GC for free-threaded builds (#114262)
* 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").
This commit is contained in:
parent
4850410b60
commit
b52fc70d1a
18 changed files with 1952 additions and 22 deletions
|
@ -212,7 +212,9 @@ struct _object {
|
|||
struct _PyMutex { uint8_t v; };
|
||||
|
||||
struct _object {
|
||||
uintptr_t ob_tid; // thread id (or zero)
|
||||
// ob_tid stores the thread id (or zero). It is also used by the GC to
|
||||
// store linked lists and the computed "gc_refs" refcount.
|
||||
uintptr_t ob_tid;
|
||||
uint16_t _padding;
|
||||
struct _PyMutex ob_mutex; // per-object lock
|
||||
uint8_t ob_gc_bits; // gc-related state
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue