[Stackless] Memory leak with Stackless and generators

Stephan Diehl stephan.diehl at gmx.net
Wed Dec 20 12:45:08 CET 2006

Stephen Dolan wrote:
> I'm on ubuntu 5.10 (kernel 2.6.12)
> I'm asking here because the stock Python interpreter does both loops
> in constant space (as would be expected), whereas the Stackless one
> uses ridiculous amounts of memory for the second one.

thanks for the clarification. (and still, my stackless on ubuntu 6.06 
does not show your described behaviour, so, my guess is that it's not 
general stackless misbehaviour)


> Stephen

================ forgot to cc the list when answering ==========
Stephen Dolan wrote:
> If I run the following bit of code: while 1: for i in [1]:pass
> it, predictably enough, eats 100% CPU and uses about 3MB RAM
> (constant)
> But, if I run def foo(): yield 1 while 1: for i in foo():pass
> it uses about 250MB RAM after 5 seconds, and steadily increases by 
> about 50MB/sec.
> Why? (it's my own build of stackless, not using any configure options
>  except --prefix and stackless_version.h reads #define 
> STACKLESS_VERSION "3.1b3 060516")

I ran your code on my Linux box with both, cpython and stackless and it
doesn't show behaviour, you are describing (both are consuming some
constant amount of ram)

 From your description, it is not really clear that it is a stackless
related problem (as you are not using any stackless features in your
If it is indeed a stackless problem, it might be helpfull, if you tell
what platform you are on.



Stackless mailing list
Stackless at stackless.com

More information about the Stackless mailing list