[Haskell-cafe] Re: hxt memory useage

Bulat Ziganshin bulat.ziganshin at gmail.com
Sat Jan 26 03:21:34 EST 2008

Hello Rene,

Friday, January 25, 2008, 10:49:53 PM, you wrote:

> Still I am a bit surprised that you can't parse 30m with 8 gig memory.

> This was discussed here before, and I think someone benchmarked HXT as using
> roughly 50 bytes of memory per 1 byte of input.
> i.e. HXT would then be using about 1.5 gig of memory for your 30m file.

to be exact, it's GHC by itself who use so many memory (on 64-bit
systems). the calculation is simple:
- one word (8 byte) for Char itself
- one word for tail pointer
- one word for laziness thunk

it's already 24 bytes. and depending on GC used, this amount increases
either 2x (with collecting GC) or 3x (with default, copying GC)

and HXT may add even more overhead, saving several copies of data or
building some lazy thunks on each char

Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com

More information about the Haskell-Cafe mailing list