Why are arrays retainers?

Akio Takano tkn.akio at gmail.com
Wed Oct 24 09:25:54 CEST 2012


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.

Takano Akio

More information about the Glasgow-haskell-users mailing list