ghc-heap-view
Version 0.4.1.0 revision 0 uploaded by JoachimBreitner.
Package meta
- Synopsis
- Extract the heap representation of Haskell values and thunks
- Description
This library provides functions to introspect the Haskell heap, for example to investigate sharing and lazy evaluation.
It has been inspired by (and taken code from) the vacuum package and the GHCi debugger, but also allows to investiage thunks and other closures.
This package also provides a new GHCi-command,
:printHeap
, which allows you to inspect the current heap representation of a value, including sharing and cyclic references. To enable the command, you need to load the included ghci script or add it to~/.ghci
, as explained bycabal install
. Once it is set up, you can do this:> let value = "A Value" > let x = (value, if head value == 'A' then value else "", cycle [True, False]) > :printHeap x let x1 = _bco x21 = [] in (x1,_bco,_bco) > length (take 100 (show x)) `seq` return () -- evaluate everything > :printHeap x let x1 = "A Value" x16 = True : False : x16 in (x1,x1,x16)
You can change the maximum recursion depth using
:setPrintHeapDepth
:> :setPrintHeapDepth 3 > :printHeap x let x1 = C# 'A' : ... : ... in (x1,x1,True : ... : ...)
If the view is impaired by blackholes (written
_bh
), runningSystem.Mem.performGC
usually helps.The work on this package has been supported by the Deutsche Telekom Stiftung (http://telekom-stiftung.de).
- Author
- Joachim Breitner, Dennis Felsing
- Bug reports
- n/a
- Category
- Debug, GHC
- Copyright
- 2012 Joachim Breitner
- Homepage
- n/a
- Maintainer
- Joachim Breitner <mail@joachim-breitner.de>
- Package URL
- n/a
- Stability
- n/a