[Python-Dev] Py_Finalize does not release all memory, not even closely (original) (raw)
Guido van Rossum guido at python.org
Tue Apr 11 19:56:50 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 ]
I'm afraid it was wishful thinking on my part.
The best we can try to hope for is to ensure that repeatedly calling Py_Initialize and Py_Finalize doesn't leak too much memory.
--Guido
On 4/11/06, "Martin v. Löwis" <martin at v.loewis.de> wrote:
Several places in the documentation claim that PyFinalize will release all memory:
http://docs.python.org/api/embedding.html says that literally, and http://docs.python.org/api/initialization.html#l2h-778 suggests it is a bug when memory is not freed in PyFinalize. This has left people to believe that this is a bug: https://sourceforge.net/tracker/index.php?func=detail&aid=1445210&groupid=5470&atid=105470 However, I don't see any chance to make this promise even remotely. Objects allocated in extension modules, and held in global variables (e.g. socketmodule.c:socketerror, socketherror, socketgaierror, sockettimeout) will never be released, right? And because of the small objects allocator, their pool will remain allocated, right? And, then, the arena. So ISTM that invoking PyFinalize after importing socket will yield atleast 256KiB garbage. Of course, that's not real garbage, because the next PyInitialize'd interpreter will continue to allocate from the arenas. But still, the actual objects that the modules hold on to will not be reclaimed until the process terminates. Please correct me if I'm wrong. Regards, Martin
Python-Dev mailing list Python-Dev at python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/guido%40python.org
-- --Guido van Rossum (home page: http://www.python.org/~guido/)
- 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 ]