Garbage collector is enabled : Garbage Collector « Language Basics « Python






Garbage collector is enabled


import gc
gc_was_enabled = gc.isenabled()
if gc_was_enabled:
    gc.collect()
    gc.disable()
# insert some time-critical code here
if gc_was_enabled:
    gc.enable()

           
       








Related examples in the same category