21 Dec 2012 11:16
ghc-heap-view now with recursive pretty-printing
Joachim Breitner <mail <at> joachim-breitner.de>
2012-12-21 10:16:02 GMT
2012-12-21 10:16:02 GMT
Hi, I get the impression that blogs and planet.haskell.org are the best way to disseminate information about new tools any more. Maybe a part of the earlier importance has been taken over by GooglePlus, but not all, leaving both blogs and GooglePlus less useful individually? Anyways, I’d like to tell you about a feature of ghc-heap-view that I have blogged about¹, namely the possibility to inspect heap values recursively in GHCi or in your programs, including thunks, the references between them and sharing: Prelude> :script /home/jojo/.cabal/share/ghc-heap-view-0.4.0.0/ghci Prelude> let x = [1..10] Prelude> x [1,2,3,4,5,6,7,8,9,10] Prelude> :printHeap x _bh [S# 1,S# 2,S# 3,S# 4,S# 5,S# 6,S# 7,S# 8,S# 9,S# 10] Note that the tools shows us that the list is a list of S# constructors, and also that it is still hidden behind a blackhole. After running System.Mem.performGC, this would disappear. Prelude> let x = Just (1 + 1) Prelude> :printHeap x Just _bco Prelude> x Just 2 Prelude> System.Mem.performGC Prelude> :printHeap x(Continue reading)
. At least it is a closure of
type BLACKHOLE
RSS Feed