[Haskell-cafe] [GHC 7.8.4] IO Monad leak space?

Tom Ellis tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk
Fri Jul 3 21:41:45 UTC 2015

On Fri, Jul 03, 2015 at 06:00:48PM +0000, Baojun Wang wrote:
> My concerns is ~80% alloc happens in f3, but both array is allocated by
> newArray? Since I'm using unboxed array I'm not expecting this kind of
> laziness.

I see.  You seem to be asking why it is allocating *at all*.  That's not
a phenomenon that normally falls under the terminology of "space leak",
hence my confusion.

I'm not an expert at reading Core, but I spent some time looking at it
without seeing anywhere that would obviously allocate a lot.  Eventually I
decided to supply the profiling options to ghc-core and lo and behold the
output changed dramatically!

Unless I am very much misunderstanding how cost centre annotations work, the
amount of allocation without -auto-all is only 10% of the amount with it. 
Please check and let me know if you concur that it is the profiling itself
that is the root cause of all the allocation!


More information about the Haskell-Cafe mailing list