STINNER Victor <vstin...@python.org> added the comment:

Maybe there should be a way to traverse all immortal code objects at Python 
exit and clear their PyCodeObject.co_quickened member (and maybe some other 
members).

Would it be possible to enhance deepfreeze be produce a list of all (immortal) 
code objects?

I did something similar for static types with _PyStaticType_Dealloc() in 
bpo-46417, but it's easy since the list of static type is known in advance and 
it's short (100 to 200 types).

--

I'm working on fixing the very old bug bpo-1635741: Python must release all 
memory that it called in Py_Finalize(). It matters when Python is embedded in 
an application. It makes sense to call Py_Initialize()/Py_Finalize() multiple 
times in such use case. Python should not leak any memory.

With my PR 30815 fix + my msg411321 workaround, "./python -I -X showrefcount -c 
pass" now says that Python leaks exactly *zero* memory block: so bpo-1635741 is 
basically fixed, for the simplest Python command ("pass"). Obviously, I expect 
that more work is needed for more complex workload, since there are other 
static types which are still not cleared at Python exit, and more C extension 
modules which are not ported to the multi-phase initialization API (PEP 489).

Valgrind is just one way to see the issue.

----------

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

Reply via email to