STINNER Victor <vstin...@redhat.com> added the comment:

I opened this issue, because I was convinced that it would be easy to implement 
checks faster than gc.setthreshold(), but I failed to write efficient tests 
which detect the bugs that I listed above.

My approach was basically to check all objects tracked by the GC every N memory 
allocations (PyGC_Malloc): too slow. I tried to put thresholds per generation: 
it was still too slow.

Maybe recent objects should be checked often, but old objects should be checked 
less often. For example, only check objects in generation 0 and scan new 
objects, and then remember the size of generation 0. At the next check, ignore 
objects already checked.

I failed to find time and interest to implement this approach. I abandon this 
issue and my PR.

In the meanwhile, gc.set_threshold(5) can be used. It isn't too slow and is 
quite good to find most bugs listed in this issue.

----------
resolution:  -> out of date
stage: patch review -> resolved
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue36389>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to