Skip to content

Leak of stgMallocBytes when using +RTS -h -i0.0001 on non-profile build

On ghc 8.10.1

I noticed this much more dramatically in a large application. To reproduce:

repro.hs :

module Main where

import Control.Concurrent
import System.Mem
import Control.Monad

main :: IO ()
main = do
    forM_ [1..60] $ \_-> do
        performGC
        threadDelay (500*1000)
    putStrLn "performGC and pause"
    performGC
    threadDelay $ 10*1000*1000

Compile with

$ ghc -O1 -fforce-recomp -threaded -rtsopts repro

Run with

heaptrack ./repro +RTS -i0.0001 -h

I can observe RES reported by top increasing. heaptrack reports leaked allocations.

heaptrack_repro

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information