Size of UArrays

Tomasz Zielonka tomasz.zielonka at gmail.com
Wed Mar 30 10:49:38 EST 2005


On Wed, Mar 30, 2005 at 06:41:02PM +0200, Andreas Marth wrote:
> Hallo!
> 
> I would like to know how big an "UArray (100,100) Double" is (approximately)
> in Bytes.

I guess you mean:
    (accumArray const 0.0 ((1, 1), (100, 100)) []) :: UArray (Int, Int) Double
It should take about 100 * 100 * 8 = 80000 bytes .

> And how much heap will the program consume for it.
> (I mean does the garbage collector need this size, or double the size, or what?)

About the same. I just checked that GHC allocates it as a big object, so
the array isn't copied during GC.

Best regards
Tomasz


More information about the Glasgow-haskell-users mailing list