[Dieter Maurer]
... Also, Python never releases integer objects it has constructed. Thus, once you iterated from 0 to 4 G, you have several GB of integer objects -- but it is unlikely that you do this...
But Python does reuse space allocated for integers when it can. So, for example, this causes no visible memory growth: i = 0 while i < 4*1024**3: i += 1 If it were possible (it isn't) to get away with doing range(4*1024**3) then the space for those 4 billion *simultaneously-alive* integers would indeed stick around forever. Same story for floats, BTW. It's the maximum number simultaneously alive that matters here, not the total number of ints or floats ever created. In any case, I sure agree this is unlikely to be "the problem" that's biting Andy.