Tim Peters wrote: > Well, there may well be a bug (or multiple bugs) underlying that one > too. It's one thing for Py_Finalize() not to release all memory (it > doesn't and probably never will), but it's not necessarily the same > thing if running Py_Initialize() ... Py_Finalize() 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 > Py_Finalize() that frees such things (like PyString_Fini and > PyInt_Fini). 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., init_socket() may get called more than > once if socket-slinging code appears in a Py_Initialize() ... > Py_Finalize(). Module initialization functions are called each time. Py_Finalize "forgets" which modules had been loaded, and reloads them all. Regards, Martin _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com