Jeremy Kloth <jeremy.kl...@gmail.com> added the comment:
> Oh wow. How did you find this leak? Did you read all C files and check for > code specific to Windows? How did you proceed? Well spotted! 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). > Which command do you type? Do you pass -I option to Python? For both as -I disables environment lookup: --- a/Python/initconfig.c +++ b/Python/initconfig.c @@ -757,6 +757,7 @@ config_init_defaults(PyConfig *config) config->user_site_directory = 1; config->buffered_stdio = 1; config->pathconfig_warnings = 1; + config->dump_refs = 1; #ifdef MS_WINDOWS config->legacy_windows_stdio = 0; #endif For linux: ./configure --enabled-shared --with-py-debug --with-trace-refs make build_all LD_LIBRARY_PATH=$PWD ./python -X showrefcount -I -c pass For Windows: Add "#define Py_TRACE_REFS 1" to PC\pyconfig.h build.bat -d -e amd64\python_d.exe -X showrefcount -I -c pass > I proposed GH-31594 to fix this macro. Even using that change, I still have negative refs (but I still have Py_TRACE_REFS defined) ---------- nosy: +jeremy.kloth _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue46857> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com