[issue46857] Python leaks one reference at exit on Windows

STINNER Victor report at bugs.python.org
Sat Feb 26 18:31:59 EST 2022


STINNER Victor <vstinner at python.org> added the comment:

> Initially, I modified Py_INCREF to dump the object (addr & tp_name) on
> initial inc (ob_refcnt == 1) and Py_DECREF to dump on final dec
> (ob_refcnt == 0). Then filter that list (~65K) to find objects not
> dealloc'ed.  Given those names (~200), cross-check with source files
> containing 'ifdef MS_WINDOWS' (and related spellings).

That's smart! Thanks for sharing. It may help to identify future leaks.


> Even using that change, I still have negative refs (but I still have
Py_TRACE_REFS defined)

Ah, maybe testing with Py_TRACE_REFS shows more bugs. I didn't try Py_TRACE_REFS recently. Well, if someone finds why it's becoming negative, a fix would be welcomed :-)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46857>
_______________________________________


More information about the Python-bugs-list mailing list