MCPcopy Index your code
hub / github.com/RustPython/RustPython / gc_collect

Function gc_collect

Lib/test/support/__init__.py:849–864  ·  view source on GitHub ↗

Force as many objects as possible to be collected. In non-CPython implementations of Python, this is needed because timely deallocation is not guaranteed by the garbage collector. (Even in CPython this can be the case in case of reference cycles.) This means that __del__ methods m

()

Source from the content-addressed store, hash-verified

847
848
849def gc_collect():
850 """Force as many objects as possible to be collected.
851
852 In non-CPython implementations of Python, this is needed because timely
853 deallocation is not guaranteed by the garbage collector. (Even in CPython
854 this can be the case in case of reference cycles.) This means that __del__
855 methods may be called later than expected and weakrefs may remain alive for
856 longer than expected. This function tries its best to force all garbage
857 objects to disappear.
858 """
859 return # TODO: RUSTPYTHON
860
861 import gc
862 gc.collect()
863 gc.collect()
864 gc.collect()
865
866@contextlib.contextmanager
867def disable_gc():

Callers 15

test_referencesMethod · 0.90
runMethod · 0.90
mainMethod · 0.90
test_asendMethod · 0.90
test_athrowMethod · 0.90
test_acloseMethod · 0.90
test_aclose_throwMethod · 0.90

Calls 1

collectMethod · 0.80

Tested by 15

test_referencesMethod · 0.72
runMethod · 0.72
mainMethod · 0.72
test_asendMethod · 0.72
test_athrowMethod · 0.72
test_acloseMethod · 0.72
test_aclose_throwMethod · 0.72