2.1. gc — Garbage Collector management


gc.enable()

Enable automatic garbage collection.

gc.disable()

Disable automatic garbage collection. Heap memory can still be allocated, and garbage collection can still be initiated manually using gc.collect().

gc.collect()

Run a garbage collection.

gc.mem_alloc()

Returns the number of bytes allocated on the heap.

gc.mem_free()

Returns the number of bytes available on the heap.