summaryrefslogtreecommitdiff
path: root/Include/internal
diff options
context:
space:
mode:
authorbrainfvck <li.zekun@gmail.com>2017-10-16 12:49:41 -0700
committerƁukasz Langa <lukasz@langa.pl>2017-10-16 12:49:41 -0700
commitc75edabbb65ca2bb29e51f8d1eb2c780e5890982 (patch)
treee437dc1926002cf3700c39696ec239da3f31dc1e /Include/internal
parentbdaeb7d237462a629e6c85001317faa85f94a0c6 (diff)
downloadcpython-git-c75edabbb65ca2bb29e51f8d1eb2c780e5890982.tar.gz
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.
Diffstat (limited to 'Include/internal')
-rw-r--r--Include/internal/mem.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/Include/internal/mem.h b/Include/internal/mem.h
index f3a8f56e80..471cdf45df 100644
--- a/Include/internal/mem.h
+++ b/Include/internal/mem.h
@@ -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;