[Tutor] out of memory conditions

VanL van@lindbergs.org
Thu, 05 Apr 2001 21:07:01 -0600


> I did this as an experiment, in X (Gnome):
>
>         x = 0
>         y = []
>         while 1:
>                 y.append(' ' * 1000000)
>                 x = x + 1
>                 print x
>
> I thought this would raise an exception, but it didn't.
>
> When x got to about 163, I got thrown out of X.  I redid 'startx', and
> everything seemed back to normal, except I couldn't run Agent
> newsreader under Wine.

This is interesting....
>>> y = []
>>> for x in range(1000):
...     y.append(' ' * 10000000)
...     print x
...
0
1
2
3
4

[snip]

61
62
63
64
Traceback (most recent call last):
  File "<stdin>", line 2, in ?
MemoryError
>>> y = 1

(Memory is freed.  Memory consumption drops by ~650 MB)

Of course, this is on Win2K, with a hard limit on the size of my
swapfile.  Are you using a swapfile or swap partition?  Linux or a BSD?

-VanL