[Python-Dev] Idea: reduce GC threshold in development mode (-X dev)

Victor Stinner vstinner at redhat.com
Fri Jun 8 04:31:51 EDT 2018

2018-06-08 10:17 GMT+02:00 Serhiy Storchaka <storchaka at gmail.com>:
> Reducing GC threshold can hide other bugs that will be reproducible only in
> the release mode (because of earlier releasing of resources or changed order
> of destroying objects).
> What is the cost of traversing all objects? Would it be too high if just
> traverse all objects every time when the garbage collecting potentially can
> happen, but without modifying any data, just check for consistency of GC
> headers?

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?


More information about the Python-Dev mailing list