On this page
gc.disable
Prev: gc.collect | Up: gc | Next: gc.enable
Rel: gc.collect, gc.enable, gc.freeze, gc.get_count
Ref: docs.python.org — gc.disable
Tags: #public #python3 #stdlib #gc
Import
import gc
from gc import disable
Signature & Overview
gc.disable()
Disable automatic garbage collection.
Usage
import gc
gc.disable()
try:
assert gc.isenabled() is False
finally:
gc.enable()
Gotchas
- Only pauses the cyclic GC (reference counting still runs): Always re-enable in a
finally:block or cyclic leaks will accumulate.
REPL Inspect
from gc import disable
help(disable)
Linked from
- tuts/python3/stdlib_module/gc
- tuts/python3/stdlib_module/gc/collect
- tuts/python3/stdlib_module/gc/enable
- tuts/python3/stdlib_module/gc/freeze
- 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/enable Linked here; links to this page; shared tags: #gc, #stdlib
- tuts/python3/stdlib_module/gc/freeze 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