08.06.18 11:31, Victor Stinner пише: > Do you suggest to trigger a fake "GC collection" which would just > visit all objects with a no-op visit callback? I like the idea! > > Yeah, that would help to detect objects in an inconsistent state and > reuse the existing implemented visit methods of all types. > > Would you be interested to try to implement this new debug feature? It is simple: #ifdef Py_DEBUG void _PyGC_CheckConsistency(void) { int i; if (_PyRuntime.gc.collecting) { return; } _PyRuntime.gc.collecting = 1; for (i = 0; i < NUM_GENERATIONS; ++i) { update_refs(GEN_HEAD(i)); } for (i = 0; i < NUM_GENERATIONS; ++i) { subtract_refs(GEN_HEAD(i)); } for (i = 0; i < NUM_GENERATIONS; ++i) { revive_garbage(GEN_HEAD(i)); } _PyRuntime.gc.collecting = 0; } #endif
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4