Why are arrays retainers?

Hi, Recently I was surprised to see that GHC's retainer profiler treated boxed arrays as retainer objects. Why are they considered retainers? I was using the +RTS -hr to figure out why there were a lot of objects of type T in the heap. However, the T objects happened to be in a HashMap (from the unordered-containers package), so the profiler pointed to the function that created the HashMap rather than the actual cause of the leak. This lead me to think that it might be useful if GHC would treat arrays as non-retainers. Also the behavior is not documented. The user's guide only mentions stacks and thunks as types of retainers, not mutable objects and boxed arrays. I'd be happy to submit a documentation patch. Regards, Takano Akio

On 24/10/2012 08:25, Akio Takano wrote:
Recently I was surprised to see that GHC's retainer profiler treated boxed arrays as retainer objects. Why are they considered retainers?
I think the intention is to treat all "mutable" objects as retainers, where thunks are a kind of mutable object. From the code it looks like both MutableArray# and Array# are treated as retainers though, which is probably a mistake. I'll fix it so that Array# is not a retainer, and update the docs to mention that mutable objects are retainers. Cheers, Simon
participants (2)
-
Akio Takano
-
Simon Marlow