Python Glossary Русский

Python 3.7+gcfunction

gc.unfreeze()

collection control

Moves objects frozen by gc.freeze back into the oldest generation, so the collector walks them again.

Syntax

gc.unfreeze()

The objects land in the oldest generation, which is fully collected rarely, so any garbage among them is not freed at once; call gc.collect() afterwards if you need that now. If freeze was called several times, unfreeze thaws everything accumulated at once, not just the last call.

Examples

import gc
gc.freeze()
gc.freeze()
gc.unfreeze()
print(gc.get_freeze_count())  # → 0 — оба freeze сняты разом

See also

Open in the full glossarydocs.python.orgReport an inaccuracy