-
Notifications
You must be signed in to change notification settings - Fork 18
[BUG] Memory leak in __hash__() #55
Copy link
Copy link
Closed
Labels
Priority: HighA blocking bug or an important featureA blocking bug or an important featureType: BugSomething isn't workingSomething isn't working
Description
Welcome! You should write in your Bug Report:
I found a case where frozendict does not free memory. The old v1 implementation does free memory in this situation.
OS version (https://www.google.com/search?channel=fs&q=check+os+version&ie=utf-8&oe=utf-8):
your OS version
$ uname -r
3.10.0-1160.59.1.el7.x86_64
Python3 version (python3 -V -V):
your Python version
3.7.6
Steps to reproduce:
import resource
import frozendict
print("frozendict version:", frozendict.__version__)
print()
c = 0
while True:
mapping = {}
fz = frozendict.frozendict({i: i for i in range(1000)})
none = mapping.setdefault(fz, None)
if (c % 10000) == 0:
max_rss = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
print(f"iteration: {c}, max rss: {max_rss} kb")
c += 1Actual result (with the python stack trace if present):
the result you see
frozendict version: 2.3.0
iteration: 0, max rss: 32196 kb
iteration: 10000, max rss: 1793552 kb
iteration: 20000, max rss: 3554452 kb
iteration: 30000, max rss: 5315972 kb
iteration: 40000, max rss: 7076784 kb
iteration: 50000, max rss: 8838472 kb
Note that this will use up memory rather fast on your machine.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Priority: HighA blocking bug or an important featureA blocking bug or an important featureType: BugSomething isn't workingSomething isn't working