[issue46857] Python leaks one reference at exit on Windows

2022-03-22 Thread STINNER Victor
STINNER Victor added the comment: The last leak of a memory block on Windows was fixed by: New changeset 88872a29f19092d2fde27365af230abd6d301941 by Jeremy Kloth in branch 'main': bpo-47084: Clear Unicode cached representations on finalization (GH-32032)

[issue46857] Python leaks one reference at exit on Windows

2022-03-03 Thread STINNER Victor
STINNER Victor added the comment: The initial issue "Python leaks one reference at exit on Windows" is now fixed. If someone wants to investigate the remaining leak of 1 memory block or the negative ref count of PYTHONDUMPREFS=1, please open a separated issue. -- resolution: ->

[issue46857] Python leaks one reference at exit on Windows

2022-02-26 Thread STINNER Victor
STINNER Victor added the comment: Ah, with PYTHONDUMPREFS=1 (and without -I), I get a negative ref count: $ PYTHONDUMPREFS=1 ./python -X showrefcount -c pass [-10 refs, 0 blocks] I don't plan to investigate this issue. I'm not using PYTHONDUMPREFS=1 anymore. --

[issue46857] Python leaks one reference at exit on Windows

2022-02-26 Thread Jeremy Kloth
Jeremy Kloth added the comment: Did you also modify initconfig.c? That part is required as the usual processing of the environment variable PYTHONDUMPREFS needed to enable tracing output is ignored with -I -- ___ Python tracker

[issue46857] Python leaks one reference at exit on Windows

2022-02-26 Thread STINNER Victor
STINNER Victor added the comment: I just built Python with --with-trace-refs. On Linux, it works as expected: $ ./python -I -X showrefcount -c pass [0 refs, 0 blocks] -- ___ Python tracker

[issue46857] Python leaks one reference at exit on Windows

2022-02-26 Thread STINNER Victor
STINNER Victor 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

[issue46857] Python leaks one reference at exit on Windows

2022-02-26 Thread STINNER Victor
STINNER Victor added the comment: New changeset ad56919c5ed54523f866e6605a2573ab7b7d5235 by Victor Stinner in branch 'main': bpo-46857: Fix refleak in OSError INIT_ALIAS() (GH-31594) https://github.com/python/cpython/commit/ad56919c5ed54523f866e6605a2573ab7b7d5235 --

[issue46857] Python leaks one reference at exit on Windows

2022-02-25 Thread Jeremy Kloth
Jeremy Kloth added the comment: > ./configure --enabled-shared --with-py-debug --with-trace-refs (that's what I get for typing from memory): ./configure --enable-shared --with-pydebug --with-trace-refs > > I proposed GH-31594 to fix this macro. > > Even using that change, I still have

[issue46857] Python leaks one reference at exit on Windows

2022-02-25 Thread Jeremy Kloth
Jeremy Kloth 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

[issue46857] Python leaks one reference at exit on Windows

2022-02-25 Thread STINNER Victor
STINNER Victor added the comment: > Good news, the difference on Windows was easy enough to find, bad news total > refs are now negative! 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! > #define

[issue46857] Python leaks one reference at exit on Windows

2022-02-25 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +29717 pull_request: https://github.com/python/cpython/pull/31594 ___ Python tracker ___

[issue46857] Python leaks one reference at exit on Windows

2022-02-25 Thread Jeremy Kloth
Jeremy Kloth added the comment: Note that an allocated block is still leaking. Strange as well, when using dump_refs, the total refs are much more negative (-12 linux, -13 Windows) -- ___ Python tracker

[issue46857] Python leaks one reference at exit on Windows

2022-02-25 Thread Jeremy Kloth
Jeremy Kloth added the comment: Good news, the difference on Windows was easy enough to find, bad news total refs are now negative! --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -3647,8 +3647,7 @@ _PyBuiltins_AddExceptions(PyObject *bltinmod) #define INIT_ALIAS(NAME, TYPE) \

[issue46857] Python leaks one reference at exit on Windows

2022-02-25 Thread STINNER Victor
STINNER Victor added the comment: New changeset ea9612a17bc60d44e0058f525d3c02a91c439cef by Victor Stinner in branch 'main': bpo-46857: Fix test_embed.test_no_memleak() on Windows (GH-31589) https://github.com/python/cpython/commit/ea9612a17bc60d44e0058f525d3c02a91c439cef --

[issue46857] Python leaks one reference at exit on Windows

2022-02-25 Thread STINNER Victor
Change by STINNER Victor : -- keywords: +patch pull_requests: +29712 stage: -> patch review pull_request: https://github.com/python/cpython/pull/31589 ___ Python tracker ___

[issue46857] Python leaks one reference at exit on Windows

2022-02-25 Thread STINNER Victor
New submission from STINNER Victor : "./python -X showrefcount -I -c pass" returns "[0 refs, 0 blocks]" as expected on Linux: Python doesn't leak any reference nor memory block. But on Windows, it still leaks 1 reference (and 1 memory block)! vstinner@DESKTOP-DK7VBIL