[Stackless] Memory footprint for tasklets and channels

Michael Sparks ms at cerenity.org
Fri Mar 17 23:10:33 CET 2006


On Friday 17 March 2006 21:19, Bob Ippolito wrote:
>  then instantiate a few million generators...  

... not such a wise idea unless you have around 2GB of ram:

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
12209 michaels   15   0  4456 2876 1616 S  0.0  0.6   0:00.05 python

>>> def fib():
...    a,b =1,1
...    while 1:
...       yield a
...       a,b = b, a+b
...
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
12209 michaels   15   0  4456 2888 1628 S  0.0  0.6   0:00.05 python

>>> x = [ fib() for X in range(4000) ]

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
12209 michaels   15   0  6040 4528 1632 S  0.0  0.9   0:00.07 python

>>> x = [ fib() for X in range(40000) ]

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
12209 michaels   15   0 22624  20m 1632 S  0.0  4.2   0:00.24 python

>>> x = [ fib() for X in range(400000) ]

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
12209 michaels   15   0  182m 180m 1632 S  0.0 36.5   0:03.24 python

(I was curious, so I thought I'd just try it :-) -- I originally just tried
4000000, and had to rapidly kill my python interpreter as my machine
started locking up... :-)


Michael.

_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://www.stackless.com/mailman/listinfo/stackless



More information about the Stackless mailing list