mirror of
https://github.com/python/cpython.git
synced 2025-08-19 00:00:48 +00:00
bpo-31558: Add gc.freeze() (#3705)
Freeze all the objects tracked by gc - move them to a permanent generation and ignore all the future collections. This can be used before a POSIX fork() call to make the gc copy-on-write friendly or to speed up collection.
This commit is contained in:
parent
bdaeb7d237
commit
c75edabbb6
5 changed files with 169 additions and 2 deletions
|
@ -167,6 +167,8 @@ struct _gc_runtime_state {
|
|||
/* linked lists of container objects */
|
||||
struct gc_generation generations[NUM_GENERATIONS];
|
||||
PyGC_Head *generation0;
|
||||
/* a permanent generation which won't be collected */
|
||||
struct gc_generation permanent_generation;
|
||||
struct gc_generation_stats generation_stats[NUM_GENERATIONS];
|
||||
/* true if we are currently running the collector */
|
||||
int collecting;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue