[New-bugs-announce] [issue31317] Memory leak in dict with shared keys

STINNER Victor report at bugs.python.org
Thu Aug 31 16:18:11 EDT 2017


New submission from STINNER Victor:

Copy attached test_leak.py to Lib/test/ and run:

haypo at selma$ ./python -m test -R 3:30 test_leak

Run tests in parallel using 1 child processes
0:00:00 load avg: 0.67 [1/1/1] test_leak failed
beginning 33 repetitions
123456789012345678901234567890123
.................................
test_leak leaked [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] memory blocks, sum=30

1 test failed:
    test_leak

Total duration: 682 ms
Tests result: FAILURE


It seems like Thread2 constructor creates a dictionary on "self.hashvalue = (...)". It's a dictionary sharing keys, but it seems like the dict table memory is not released whne the bug occurs.


Sadly, I'm only able to reproduce the bug on a 32-bit build. Since the bug depends on exact hash values, maybe the bug exists in 64-bit builds, but is less likely?


I'm not 100% sure if the bug is related to dict or set.


The bug comes from bpo-31217.

----------
messages: 301058
nosy: haypo, inada.naoki, rhettinger, xiang.zhang
priority: normal
severity: normal
status: open
title: Memory leak in dict with shared keys
type: resource usage
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue31317>
_______________________________________


More information about the New-bugs-announce mailing list