MCPcopy Create free account
hub / github.com/numpy/numpy / break_cycles

Function break_cycles

numpy/testing/_private/utils.py:2369–2384  ·  view source on GitHub ↗

Break reference cycles by calling gc.collect Objects can call other objects' methods (for instance, another object's __del__) inside their own __del__. On PyPy, the interpreter only runs between calls to gc.collect, so multiple calls are needed to completely release all cycles.

()

Source from the content-addressed store, hash-verified

2367
2368
2369def break_cycles():
2370 """
2371 Break reference cycles by calling gc.collect
2372 Objects can call other objects' methods (for instance, another object's
2373 __del__) inside their own __del__. On PyPy, the interpreter only runs
2374 between calls to gc.collect, so multiple calls are needed to completely
2375 release all cycles.
2376 """
2377
2378 gc.collect()
2379 if IS_PYPY:
2380 # a few more, just to make sure all the finalizers are called
2381 gc.collect()
2382 gc.collect()
2383 gc.collect()
2384 gc.collect()
2385
2386
2387def requires_memory(free_bytes):

Calls

no outgoing calls