[Python-Dev] ref leaks

Thomas Wouters thomas at python.org
Thu Apr 24 17:35:56 CEST 2014


On Thu, Apr 24, 2014 at 7:31 AM, Ethan Furman <ethan at stoneleaf.us> wrote:

> On 04/23/2014 09:06 PM, Benjamin Peterson wrote:
>
>> On Wed, Apr 23, 2014, at 19:14, Ethan Furman wrote:
>>
>>> Command line:
>>>
>>>     ./python -m test.regrtest -v -R3:3 test_tools
>>>
>>> Results:
>>>
>>>     Ran 44 tests in 7.628s
>>>
>>>     OK (skipped=1)
>>>     .
>>>     test_tools leaked [0, 2, 2] references, sum=4
>>>     1 test failed:
>>>         test_tools
>>>
>>> Any words of wisdom for tracking those leaks?
>>>
>>
>> Unless it's consistent, that sort of behavior usually just gets
>> dismissed as intermittent.
>>
>
> test_tools leaked [331, 0, 0] references, sum=331
> test_tools leaked [108, 1, 0] memory blocks, sum=109
>
> test_tools leaked [2, 0, 0] references, sum=2
>
> test_tools leaked [0, 0, 4] references, sum=4
> test_tools leaked [0, 0, 3] memory blocks, sum=3
>
> Consistently the same, or consistently happening?  ;)
>

Consistently a leak. If it's an occasional reported leak (especially in the
first or last of the reported runs) or a mixture of positive and negative
numbers, it's more likely it's an effect of delayed cleanup, for whatever
reason. regrtest's -R takes two integers, 'stab' and 'run', for the number
of times to run the same test without tracking reference counts (to
stabilize caching effects) and the number of times to run the test while
tracking reference counts. Some tests don't stabilize as easily as others,
for example because the actual workload or timings rely on external
sources. '2, 0, 0' and '0, 0, 4' are probably not leaks, but if you're
worried you can run them with larger 'stab' and 'run' to see if they
stabilize, or a smaller 'stab' to see if they just have unreliable refcount
effects.

The easiest way to debug these things is to reduce the test until it has no
net refcount effect, then look at the last thing you removed :)

-- 
Thomas Wouters <thomas at python.org>

Hi! I'm an email virus! Think twice before sending your email to help me
spread!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20140424/ec17bfa4/attachment.html>


More information about the Python-Dev mailing list