Several places in the documentation claim that Py_Finalize 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 Py_Finalize.

This has left people to believe that this is a bug:

https://sourceforge.net/tracker/index.php?func=detail&aid=1445210&group_id=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:socket_error, socket_herror, socket_gaierror,
socket_timeout) 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 Py_Finalize after importing socket will yield
atleast 256KiB garbage. Of course, that's not real garbage, because
the next Py_Initialize'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@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to