[Haskell-cafe] Program using 500MB RAM to process 5MB file

Ketil Malde ketil at malde.org
Fri Apr 3 04:22:07 EDT 2009


lucas at die.net.au writes:

> I'm relatively new to haskell so as one does, I am rewriting an
> existing program in haskell to help learn the language.

> However, it eats up all my RAM whenever I run the program.

This typically happens to me when I parse large files and either am a)
using a parser that is too strict (like Luke says) or b) using a
parser that is too lazy - or rather, it parses into a lazy data
structure which is then populated with unevaluated thunks holding onto
the input data.

Also, you probably want memory profiling (+RTS -h and friends), not
time profiling (+RTS -p).

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants


More information about the Haskell-Cafe mailing list