ERROR - Garbage collection fails to reclaim sufficient space
L.S., When reading a lot of files, Hugs gives the message: ERROR - Garbage collection fails to reclaim sufficient space I had this problem before with Hugs Version Nov 2002 after 40 files, now with Hugs Version Nov 2003, it happens after 60 or 61 files; see the attached program. If you want sample data files, just ask me. -- Best regards, Henk-Jan van Tuyl
To improve on the behaviour you're seeing, you either have to up the heap size (via :set -h), or fix the space leak in your program (*). Hugs doesn't dynamically expand the size of its heap. --sigbjorn * - here's one possible solution to letting go of input file data in a timely fashion:
collectAllData :: [String] -> -- A list of filenames IO [String] -- A list of results
collectAllData xs = mapM collectFileData xs >>= return.concat
collectFileData :: String -> IO [String] collectFileData fn = do putStrLn $ "Reading: " ++ fn contents <- readFile fn case parseIt contents of (a,b) | seqList a && seqList b -> return [fn,a,b,""] where parseIt cs = parseFile $ filter (/= "") $ lines cs
seqList :: [a] -> Bool seqList [] = True seqList (x:xs) = x `seq` seqList xs
Henk-Jan.van.Tuyl
L.S.,
When reading a lot of files, Hugs gives the message: ERROR - Garbage collection fails to reclaim sufficient space
I had this problem before with Hugs Version Nov 2002 after 40 files, now with Hugs Version Nov 2003, it happens after 60 or 61 files; see the attached program. If you want sample data files, just ask me.
-- Best regards, Henk-Jan van Tuyl
participants (2)
-
Henk-Jan.van.Tuyl -
Sigbjorn Finne