Memory grows (without bound); doesn't if code is in function

Irmen de Jong irmen at -nospam-remove-this-xs4all.nl
Tue Oct 5 23:15:27 CEST 2004


Jeff Epler wrote:
> I wrote this program, and when I ran it the Python process grew to 200+
> megs, and I was forced to kill it:
>     # Program 1: code at module level
>     import itertools
>     j = 0
>     for i in itertools.count():
>         j = j + str(i).count("1")
>         if j == i: print i
> 

Weird. This program runs fine on my systems (win xp and mandrake-linux 10.0,
both usig python 2.3.4 ... using about 3.5 to 4mb memory.)
Perhaps it's a python 2.3.2 thing that was fixed in 2.3.3 or 2.3.4?

--Irmen.



More information about the Python-list mailing list