[issue3063] memory leak in random number generation

Tim Peters report at bugs.python.org
Sun Jun 8 18:46:41 CEST 2008


Tim Peters <tim.peters at gmail.com> added the comment:

They stayed alive simultaneously because you stored 100 million of them
simultaneously in a list (data[]).  If instead you did, e.g.,

for i in xrange(100000000):
    x = random()

the problem would go away -- then only two float objects are
simultaneously alive at any given time (the "old" float in `x` stays
alive until the "new" float created by random() replaces it).

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


More information about the Python-bugs-list mailing list