[Python-Dev] Py_Finalize does not release all memory, not even closely (original) (raw)
"Martin v. Löwis" martin at v.loewis.de
Sat Apr 15 14:57:25 CEST 2006
- Previous message: [Python-Dev] Py_Finalize does not release all memory, not even closely
- Next message: [Python-Dev] Py_Finalize does not release all memory, not even closely
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Tim Peters wrote:
Well, there may well be a bug (or multiple bugs) underlying that one too. It's one thing for PyFinalize() not to release all memory (it doesn't and probably never will), but it's not necessarily the same thing if running PyInitialize() ... PyFinalize() repeatedly keeps leaking more and more memory.
Running Py_Initialize/Py_Finalize once leaves 2150 objects behind (on Linux). The second run adds 180 additional objects; each subsequent run appears to add 156 more.
Not unless the module has a finalization function called by PyFinalize() that frees such things (like PyStringFini and PyIntFini).
How should the module install such a function? PyString_Fini and PyInt_Fini are invoked explicitly in pythonrun.c. That doesn't scale to extension modules.
I'm not clear on whether, e.g., initsocket() may get called more than once if socket-slinging code appears in a PyInitialize() ... PyFinalize().
Module initialization functions are called each time. Py_Finalize "forgets" which modules had been loaded, and reloads them all.
Regards, Martin
- Previous message: [Python-Dev] Py_Finalize does not release all memory, not even closely
- Next message: [Python-Dev] Py_Finalize does not release all memory, not even closely
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]