[Haskell-cafe] Sub-optimal

Daniel Fischer daniel.is.fischer at googlemail.com
Sat Feb 12 12:48:51 CET 2011

On Saturday 12 February 2011 11:30:26, Andrew Coppin wrote:
> I have a small program that fills a file with random numbers. If I
> compile it without optimisation, it runs in constant space. And yet, if
> I supply -O2 (or even just -O1), for large output files the program
> gobbles large amounts of RAM.
> Is this a known bug? (GHC 6.10.x)

It's known to happen when optimising shares what shouldn't be shared. Try 
compiling with -O2 -fno-cse (if that doesn't help, it doesn't necessarily 
mean it's not unwanted sharing, though).
And, please, let us see some code to identify the problem.

More information about the Haskell-Cafe mailing list