On this page
gc.freeze
Prev: gc.enable | Up: gc | Next: gc.get_count
Rel: gc.collect, gc.disable, gc.enable, gc.get_count
Ref: docs.python.org — gc.freeze
Tags: #public #python3 #stdlib #gc
Import
import gc
from gc import freeze
Signature & Overview
gc.freeze()
Freeze all current tracked objects and ignore them for future collections.
Usage
import gc
# Moves all currently tracked objects to a permanent generation (ignored by future GC runs)
assert callable(gc.freeze)
Gotchas
- Used before
os.fork()in pre-fork web servers (Gunicorn/uWSGI) to avoid copy-on-write page faults during child GC cycles.
REPL Inspect
from gc import freeze
help(freeze)
Linked from
- tuts/python3/stdlib_module/gc
- tuts/python3/stdlib_module/gc/collect
- tuts/python3/stdlib_module/gc/disable
- tuts/python3/stdlib_module/gc/enable
- tuts/python3/stdlib_module/gc/get_count
- tuts/python3/stdlib_module/gc/get_debug
- tuts/python3/stdlib_module/gc/get_freeze_count
- tuts/python3/stdlib_module/gc/get_objects
- tuts/python3/stdlib_module/gc/get_referents
- tuts/python3/stdlib_module/gc/get_referrers
- tuts/python3/stdlib_module/gc/get_stats
- tuts/python3/stdlib_module/gc/get_threshold
- tuts/python3/stdlib_module/gc/is_finalized
- tuts/python3/stdlib_module/gc/is_tracked
- tuts/python3/stdlib_module/gc/isenabled
- tuts/python3/stdlib_module/gc/set_debug
- tuts/python3/stdlib_module/gc/set_threshold
- tuts/python3/stdlib_module/gc/unfreeze
Related notes
- tuts/python3/stdlib_module/gc/collect Linked here; links to this page; shared tags: #gc, #stdlib
- tuts/python3/stdlib_module/gc/disable Linked here; links to this page; shared tags: #gc, #stdlib
- tuts/python3/stdlib_module/gc/enable Linked here; links to this page; shared tags: #gc, #stdlib
- tuts/python3/stdlib_module/gc/get_count Linked here; links to this page; shared tags: #gc, #stdlib
- tuts/python3/stdlib_module/gc Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/gc/get_debug links to this page; shared tags: #gc, #stdlib
- tuts/python3/stdlib_module/gc/get_freeze_count links to this page; shared tags: #gc, #stdlib
- tuts/python3/stdlib_module/gc/get_objects links to this page; shared tags: #gc, #stdlib
- tuts/python3/stdlib_module/gc/get_referents links to this page; shared tags: #gc, #stdlib
- tuts/python3/stdlib_module/gc/get_referrers links to this page; shared tags: #gc, #stdlib