Skip to content

GHC-9.0 is too reluctant to return memory with non-copying collectors

On the ghc-9.0 branch the rts is too reluctant to return memory to the OS. See https://gitlab.haskell.org/ghc/ghc/-/blob/ghc-9.0/rts/sm/GC.c#L953:

need = need_prealloc + (RtsFlags.GcFlags.oldGenFactor + 2) * need_live;

This always keeps (F + 2)*Live memory, yet if we are using the non-moving or compacting collectors then (F+1.2)*Live should be enough.

This was fixed by afc357d2, which also introduces the -Fd flag. As this added a feature it wasn't backported. Yet, I think the part of this commit that fixes this coefficient should be backported to the 9.0 line.

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