[Python-Dev] Discussion related to memory leaks requested

Matthew Paulson paulson at busiq.com
Wed Jan 13 17:49:41 EST 2016


Hi Victor:

No, I'm using the new heap analysis functions in DS2015.  We think we 
have found one issue. In the following sequence, dict has no side 
effects, yet it is used -- unless someone can shed light on why dict is 
used in this case:

/* 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);

And removing dict from this sequence seems to have fixed one of the 
issues, yielding 14k per iteration.

Simple program: Good idea.  We will try that -- right now it's embedded 
in a more complex environment, but we have tried to strip it down to a 
very simple sequence.

The next item on our list is memory that is not getting freed after 
running simple string.  It's in the parsertok sequence -- it seems that 
the syntax tree is not getting cleared -- but this opinion is preliminary.

Best,

Matt

On 1/13/2016 5:10 PM, Victor Stinner wrote:
> Hi,
>
> 2016-01-13 20:32 GMT+01:00 Matthew Paulson <paulson at busiq.com>:
>> I've spent some time performing memory leak analysis while using Python in an embedded configuration.
> Hum, did you try tracemalloc?
>
> https://docs.python.org/dev/library/tracemalloc.html
> https://pytracemalloc.readthedocs.org/
>
>> 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.
> Are you able to reproduce the leak with a simple program?
>
> Victor
>
>

-- 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20160113/fedda01a/attachment-0001.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/fedda01a/attachment-0001.jpe>


More information about the Python-Dev mailing list