[pypy-issue] [issue1608] Memory leak when accessing a dictionary with an non-existent key

orf tracker at bugs.pypy.org
Wed Sep 18 01:03:14 CEST 2013


New submission from orf <tom at tomforb.es>:

Running the attached code using 2.1 on Windows will cause a MemoryError. It creates a 
dictionary containing 10,000,000 unicode keys and attempts to access the dictionary 
using both a valid and an invalid key

Upon accessing the dictionary with an invalid key the program terminates with a 
MemoryError.

----------
files: pypy_bug.py
messages: 6179
nosy: orf, pypy-issue
priority: bug
release: 2.1
status: unread
title: Memory leak when accessing a dictionary with an non-existent key

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue1608>
________________________________________
-------------- next part --------------
import random, string

big_dict = {"".join([random.choice(string.printable)
                     for i in xrange(40)]): random.randint(0,10000) for _ in xrange(10000000)}
valid_key = big_dict.keys()[0]
print "Valid key: %s" % big_dict[valid_key]
print "Invalid key: %s" % big_dict["test"]


More information about the pypy-issue mailing list