Well-Typed - The Haskell Consultants: Improvements to memory usage in GHC 9.2


We have a daemon process in production that uses a lot of heap at startup and then goes relatively quiet, see the heap profile below. I suspected that the RTS was not releasing the memory, glad to see it confirmed now.

I wonder how much of a problem this is in practice though. Shouldn’t the OS be able to page out all the unused blocks?

I think linux would put the unused pages in swap if it deemed it a good idea. But that would still use resources.

(Amazing amount of : in that profile!)

There’s so many layers of bad here:

  • bad code that should be rewritten on top of a streaming library
  • bad profiler that doesn’t show full types: are those lists strings, or something else?
  • bad GC that doesn’t release the memory - thanks @mpickering and Hasura for taking care of that!