Marc van Dongen= <[EMAIL PROTECTED]> writes:

> A 4MB heap does not suffice for the following (artificial)
> program. Given the nature of the program this seems to have
> been caused by a (perhaps already known) space leak.
> 
> 
> > module Main( main ) where
> 
> > big :: Integer
> > big = 100
> 
> > f :: Integer -> Integer -> Integer
> > f x y = x^big + y^big
> 
> > main = putStr str >>
> >        putStr "\n" >>
> >        return ()
> >      where str = show [f x y | x <- [1..big], y <- [1..big]]
> 
> I was trying this program to see if there was much difference
> in execution time if the last line of this program was changed to
> 
> >      where str = (show.concat)
> >                  [let fx = f x in [fx y | y <- [1..big]] | x <- [1..big]]

I didn't look into this too deeply, because it appears to be fixed in
3.00.  It appears to be caused by some non-sharing of dictionaries: we
fixed one such bug a while back, but it's possible there was another
one lurking.

Cheers,
        Simon

-- 
Simon Marlow                                             [EMAIL PROTECTED]
University of Glasgow                       http://www.dcs.gla.ac.uk/~simonm/
finger for PGP public key

Reply via email to