This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients vstinner
Date 2022-01-21.03:02:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1642734126.76.0.617739526871.issue46449@roundup.psfhosted.org>
In-reply-to
Content
Using the C program below, I see that _Py_RefTotal is decreasing at each iteration:
---
#include <Python.h>
int main(int argc, char *argv[])
{
    for (int i=1; i <= 100; i++) {
        Py_SetProgramName(L"./_testembed");
        Py_Initialize();
        Py_Finalize();
        printf("Loop #%d: %zd refs\n", i, _Py_RefTotal);
    }
}
---

Example of output:
---
...
Loop #96: 9557 refs
Loop #97: 9544 refs
Loop #98: 9531 refs
Loop #99: 9518 refs
Loop #100: 9505 refs
---

It seems to be a regression caused by this change:

commit 1cbaa505d007e11c4a1f0d2073d72b6c02c7147c
Author: Guido van Rossum <guido@python.org>
Date:   Wed Nov 10 18:01:53 2021 -0800

    bpo-45696: Deep-freeze selected modules (GH-29118)
    
    This gains 10% or more in startup time for `python -c pass` on UNIX-ish systems.
    
    The Makefile.pre.in generating code builds on Eric's work for bpo-45020, but the .c file generator is new.
    
    Windows version TBD.


Before the change, _Py_RefTotal was stable: 
---
...
Loop #97: 10805 refs
Loop #98: 10805 refs
Loop #99: 10805 refs
Loop #100: 10805 refs
---

I found this issue while working on bpo-46417 which is related to bpo-1635741.
History
Date User Action Args
2022-01-21 03:02:06vstinnersetrecipients: + vstinner
2022-01-21 03:02:06vstinnersetmessageid: <1642734126.76.0.617739526871.issue46449@roundup.psfhosted.org>
2022-01-21 03:02:06vstinnerlinkissue46449 messages
2022-01-21 03:02:06vstinnercreate