mathr / blog / #

hp2pretty-0.10 released

hp2pretty is a tool I wrote to graph Haskell heap profiling output, to help see where your program is using memory.

Install with cabal update && cabal install hp2pretty, run with hp2pretty --help (assuming cabal installed it somewhere in your PATH - otherwise try ~/.cabal/bin).

The changes in this release are contributed by David Hewson. Previously, hp2pretty would read the whole input.hp file into memory, and go through it twice (once to collect statistics about what needs to be plotted, and the second time to do the actual plotting). This worked fine for small to medium files, but for huge files that don't fit into available free memory this causes problems (operating system swapping pages out to slow disks, or worse).

Now the trick is to open and read the file twice instead of keeping it in memory, and using the Lazy variant of Text allows the data to be garbage collected as soon as it has been processed each time through the file, greatly reducing peak memory consumption. Altogether it also seems to speed things up for less huge files (I didn't yet figure out exactly why), even though the real aim was to make processing very huge files possible in the first place.

You can get the latest from git here:

git clone

or install from Hackage.