Hi,
When compiling with ghc 6.4.1 -O, and with randomLines exported, this
program leaks memory (possibly because we get a randomRs CAF sitting
waiting for a generator hanging around in memory, but I'm not sure).
It looks fixed in the CVS snapshot I have, but I thought I'd report it
anyway in case either it isn't fixed in the STABLE branch, or there is
still a problem lurking but this case doesn't trigger it any more.
Originally reported here:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=350443
Thanks
Ian
module Main (main, randomLines) where
import System.Random (StdGen, getStdGen, split, randomRs)
import Data.Char (chr)
randomLines :: StdGen -> [String]
randomLines g = splits splitPoints toSplit
where toSplit = map (chr . (65 +)) $ randomRs (0, 9) g1
splitPoints = randomRs (30, 50) g2
(g1, g2) = split g
splits :: [Int] -> String -> [String]
splits (s:ss) xs = case splitAt s xs of
(ys, zs) -> ys:splits ss zs
splits [] _ = []
main :: IO ()
main = do g <- getStdGen
mapM_ putStr $ take 600000 $ randomLines g
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs