ghclive icon indicating copy to clipboard operation
ghclive copied to clipboard

ghclive eats huge amounts of memory at [0..], 100% CPU

Open mikeplus64 opened this issue 12 years ago • 1 comments

If a user types in [0..], ghclive alarmingly quickly consumes all your memory and 100% CPU, bringing the system to a grinding halt. In GHCi at least, a simple expression like [0..] won't leak huge amounts of memory -- in fact, GHCi's memory usage stays seems to stay about the same.

mikeplus64 avatar Aug 21 '12 08:08 mikeplus64

There are a couple of fixes that could be applied. One is we could add lazy nodes to the result stream and then round trip to demand them when they are 'poked' by the user. Separately, we could limit the default recursion depth of Display, and make it insert those or just temporarily put '...' when it goes too deep. The trick then is naming those temporaries.

ekmett avatar Aug 21 '12 13:08 ekmett