[Haskell-cafe] UArray Word16 Word32 uses twice as much memory as it should?

Arne Dehli Halvorsen arne.d.h at gmail.com
Wed Nov 19 03:57:01 EST 2008

I am having an issue with these unboxed arrays.
I have some code that creates this structure:: (Array Word16 (UArray Int
Word32), Array Word16 (UArray Int Word8)), and I am finding that it uses
about twice as much memory as I had anticipated.

This tuple is returned strict, and I think I haven't left much room for
other data remaining in memory.

It should hold one Word8 and one Word32 for a data set of 100 million
records, and it uses around 1 gigabyte. By my calculations, it should be
half that.  So I was wondering if I might have hit upon a 64-bit vs 32-bit

I  compile with:

ghc --make load05 -O1 -funbox-strict-fields -XBangPatterns -fvia-C
(also tried with -O2, and without the -fvia-C)

using the packaged version of ghc 6.10.1 on MacOSX 10.5.5

Grateful for any pointers,

Arne D Halvorsen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20081119/8ac15825/attachment.htm

More information about the Haskell-Cafe mailing list