Python hits the spot

Chris Liechti cliechti at
Sun Jun 23 16:59:43 EDT 2002

kurlberg at (Pär Kurlberg) wrote in
news:yppfsn3dlpco.fsf at 
> Funny you should mention this.  On my laptop (IBM Thinkpad with 128
> megs of ram) the following two-liner gets me a lockup (i.e. keyboard
> and mouse completely unresponsive, powertoggle needed):
> for i in range(50*1000*1000):
>    pass
> (I am serious.)  Happened some time ago, but I never got around to
> filing a bug report (this thread was a good reminder.)  Seems like the
> python code exercises the linux VM/swap to the breaking point.  It is
> rather annoying that a user space program can do this...
> Can someone else reproduce this behaviour?  (Make sure to quit all
> important applications before you try!)

i had to lower te number to not get a MemoryError on my machine (96MB)
it runs uses some time, begins to use swap and then gets killed by the OOM 
(Kernel 2.4.17, Debian Woody Linux)

the old kernel 2.2 went crazy when no more memory was left. thats fixed 
with the Out-Of-Memory-Killer in newer kenels.

it is _not_ a python problem!

for such loops like the above 'xrange' was invented.


Chris <cliechti at>

More information about the Python-list mailing list