Thanks, Carl.
This bit of code certainly exhibits the surprising property that some runs unpredictably stall for a very long time. Further, it seems that this stall time can be made arbitrarily large by increasing the number of nodes generated (== more data in the old generation == more stuff to traverse if lots of garbage is generated and survives the young generation?). As a user of an incremental garbage collector, I would expect that there are pauses due to GC, but that these are predictable and small.
I tried running
PYPY_GC_NURSERY=2000M pypy ./mem.py 10000000
but that seemed to have no effect.
I'm looking forward to the results of the Software Transactional Memory, btw :)
/Martin