[Haskell-cafe] memory leak in Random.randoms or makeList?

S. Alexander Jacobson haskell at alexjacobson.com
Wed Dec 1 16:10:20 EST 2004


Using ghci, I am getting this error message:

  *Main> timeOp $ print $ sizeFM bigFM'
  GHC's heap exhausted: current limit is 268435456 bytes;

>From this code:

  makeList x = map ((\x->x `mod` range).abs) $
			 Random.randoms (Random.mkStdGen x)::[Int]
  range=100000
  fmRecords' n = listToFM $ take n $ zip (makeList 100) (makeList 200)
  fmRecords n = listToFM $ take n $ zip [range..] [range..]
  fmSize=10^6
  bigFM = fmRecords fmSize
  bigFM' = fmRecords' fmSize

bigFM works fine so the leak is obviously within
makeList.  I just don't understand how makeList
could produce this error...

-Alex-


______________________________________________________________
S. Alexander Jacobson tel:917-770-6565 http://alexjacobson.com


More information about the Haskell-Cafe mailing list