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
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com