[New-bugs-announce] [issue12075] python3.2 memory leak when setting integer key in dictionary

kai zhu report at bugs.python.org
Sat May 14 09:16:32 CEST 2011


New submission from kai zhu <kaizhu at ugcs.caltech.edu>:

i'm using the latest debian unstable python3.2 build on colinux (2011, may, 14)

## leak.py
## >>> import imp, leak; imp.reload(leak)
## will leak ~2.5mb per reload
## on i386 debian unstable machine (according to top).
## in my real world app (an automatic build system),
## i run out of memory after a number reloads :(
class Foo(object): pass
Foo.leaky_dictionary = {}
for aa in range(256):
  for bb in range(256):
    Foo.leaky_dictionary[(bb << 8) | aa] = None


$ python3.2
Python 3.2.1a0 (default, May  5 2011, 00:47:12)
[GCC 4.6.1 20110428 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import imp, leak; imp.reload(leak) ## 11mb
<module 'leak' from 'leak.py'>
>>> import imp, leak; imp.reload(leak) ## 13mb
<module 'leak' from 'leak.py'>
>>> import imp, leak; imp.reload(leak) ## 16mb
<module 'leak' from 'leak.py'>
>>> import imp, leak; imp.reload(leak) ## 19mb
<module 'leak' from 'leak.py'>

----------
messages: 135961
nosy: kaizhu
priority: normal
severity: normal
status: open
title: python3.2 memory leak when setting integer key in dictionary
type: resource usage
versions: Python 3.2

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


More information about the New-bugs-announce mailing list