[Haskell-cafe] Is there any way to prevent a computation from being
prokhorenkov at gmail.com
Sat Nov 13 11:55:52 EST 2010
I've came upon very a strange situation with memory consumption. The
smallest test case I've been able to come up with is the following:
wtf d = head . dropWhile (< 10^100) . map (*d) $ enumFrom 2
main = do
print $ wtf 1
print $ wtf 2 -- Everything is ok without this line
Expected result is that program runs in constant space. What really
happening is that the program consumes memory until killed.
If second call to wtf is removed, memory usage stays constant while the
program is working.
The problem is in that list returned from enumFrom is being saved between
calls to wtf.
Is there any way to overcome this?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe