[Haskell-cafe] Battling laziness

Simon Marlow simonmar at microsoft.com
Fri Dec 16 10:47:31 EST 2005


On 16 December 2005 15:23, Joel Reymont wrote:

> Looking at http://wagerlabs.com/randomplay.hd.ps I see closures
> (constructors?) in this order
> 
> <Script.Array.sat_s46N>
> W8#
> I#
> <Script.Array.fromIntegral_s453>
> <Script.Endian.sat_s1WxM>
>> 
> <Script.Endian.sat_s1WF2>
> W16#
> <Script.PicklePlus.sat_s38YS>
> stg_ap_2_upd_info

Ok, so your heap is mainly full of (a) thunks generated by something in
Script.Array, (b) Word8s, and (c) Ints.

> This tells me it's something having to do with array code. I'm
> attaching the Script.Array module at the end. This report does not
> tell me who is retaining the data, though.
> 
> Looking at http://wagerlabs.com/randomplay.hy.ps I see types ordered
> like this
> 
> *
> Word8
> Int
> ->*
> []
> Char
> Word16
> TableInfo

interesting... Word8 and Int correspond to the -hd output above, but '*'
indicates that the type of the <Script.Array.sat_s46N> is polymorphic.
Completely polymorphic closures like this are usually (error
"something"), which is a silly thing to fill up your heap with :-)

I'm a bit mystified though, because looking at the code for
Script.Array, all your arrays are unboxed, so I don't know where all the
Word8s and Ints are coming from.  It might be useful to do "+RTS
-hyWord8 -hc" to see who generated the Word8s.  Oh, and it looks like
you aren't doing -auto-all, that would probably be helpful.

Cheers,
	Simon


More information about the Haskell-Cafe mailing list