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

lucas at die.net.au lucas at die.net.au
Fri Apr 3 07:27:08 EDT 2009

On Fri, Apr 03, 2009 at 10:22:07AM +0200, Ketil Malde wrote:
> 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.

Thanks for all the help everyone . I've decided to dump Parsec, as the file
structure is simple enough to implement using basic list manipulation
(which is, I've read, one of haskell's strong points) and has turned
out to be much simpler code.

I think I was reading the write your own scheme tutorial when I
started writing that code, so natually started using parsec.

As a side note, I was reading the I/O section of RWH last night and
came across the lazy vs. strict I/O part, however it didn't occur to
me that Parsec was strict.

Anyway, thanks for all the help and suggestions.

Lucas Hazel <lucas at die.net.au>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20090403/4cfee7b8/attachment.bin

More information about the Haskell-Cafe mailing list