[Python-Dev] Discussion related to memory leaks requested

Matthew Paulson paulson at busiq.com
Wed Jan 13 14:32:23 EST 2016


Hi:

I've spent some time performing memory leak analysis while using Python 
in an embedded configuration.

The pattern is:

    Py_Initialize();

    ... run empty python source file ...

    Py_Finalize();


I've identified several suspect areas including dictionary maitenace in 
import.c:~ 414

     /* Clear the modules dict. */
     PyDict_Clear(modules);
     /* Restore the original builtins dict, to ensure that any
        user data gets cleared. */
     dict = PyDict_Copy(interp->builtins);
     if (dict == NULL)
         PyErr_Clear();
     PyDict_Clear(interp->builtins);
     if (PyDict_Update(interp->builtins, interp->builtins_copy))
         PyErr_Clear();
     Py_XDECREF(dict);
     /* Clear module dict copies stored in the interpreter state */


Is there someone in the group that would like to discuss this topic.  
There seems to be other leaks as well.  I'm new to Python-dev, but 
willing to help or work with someone who is more familiar with these 
areas than I.

Thanks,

Matt


-- 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20160113/f44fba42/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MattSig.JPG
Type: image/jpeg
Size: 38491 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-dev/attachments/20160113/f44fba42/attachment.jpe>


More information about the Python-Dev mailing list