Skip to content

interpreter: sequence_ (replicate 100000000 (return ())) gobbles up memory

I consider this to be more of a curiosity than a bug, but it might still be worth investigating. The following line,

sequence_ (replicate 100000000 (return ()))

causes ghci to grow quite big (here it's 6GB on 64 bit Linux; it's roughly proportional to the 100000000 number).

This used to be better in ancient times--before version 8.0.1, ghci ran this code in what looks like constant memory.

(This came up indirectly on #haskell; somebody had adapted Hutton's game of life program, http://www.cs.nott.ac.uk/~gmh/life.lhs which uses busy waiting for a delay.)

Trac metadata
Trac field Value
Version 8.4.3
Type Bug
TypeOfFailure OtherFailure
Priority low
Resolution Unresolved
Component GHCi
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information