Entradas

Mostrando las entradas de julio, 2022

Diagnose memory leaks on PINNED values with GHC 9.2.1 and up

Imagen
I pride myself on my odd ability for diagnosing memory leaks on Haskell. I have sent some PRs on OSS with some neat diagrams to corroborate the fixes and they are always welcomed. It is a good way to get to know a project and can be considered a low level bug in most cases. The common way to learn how to do this is reading the GHC user guide section on profiling and experimenting on your own programs. What I usually end up doing is this: Compile with profiling enabled: Either ghc -prof -fprof-auto stack build --profile cabal v2-build --enable-profiling Generate some figures with ./program-exe +RTS -xc -L350 -p -hc Use hp2pretty to generate a diagram. This can involve pruning the uninteresting sections of the program-exe.hp file to get a specific interval in time. Identify the offending band on the resulting SVG, identify the cost centre stack reported on the .hp file and read the code