The ghc-heap-view package

[Tags: bsd3, library]

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 by cabal 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), running System.Mem.performGC usually helps.

The work on this package has been supported by the Deutsche Telekom Stiftung (http://telekom-stiftung.de).


Properties

Versions0.1, 0.2, 0.3, 0.3.0.1, 0.3.0.2, 0.3.0.3, 0.3.0.4, 0.4.0.0, 0.4.1.0, 0.4.2.0, 0.5, 0.5.0.1, 0.5.1, 0.5.2, 0.5.3
Dependenciesbase (>=4.5 && <4.8), binary, bytestring (>=0.10), containers, ghc (<7.7), template-haskell, transformers or
base (>=4.5 && <4.8), binary, bytestring (>=0.10), containers, ghc (>=7.7), template-haskell, transformers
LicenseBSD3
Copyright2012-2014 Joachim Breitner
AuthorJoachim Breitner, Dennis Felsing
MaintainerJoachim Breitner <mail@joachim-breitner.de>
CategoryDebug, GHC
Bug trackerhttps://github.com/nomeata/ghc-heap-view
Source repositoryhead: git clone git://git.nomeata.de/ghc-heap-view.git(Cabal)
UploadedWed Oct 8 07:45:03 UTC 2014 by JoachimBreitner
DistributionsNixOS:0.5.3, Stackage:0.5.3
Downloads1985 total (116 in last 30 days)
StatusDocs uploaded by user
Build status unknown [no reports yet]

Modules

[Index]

Flags

NameDescriptionDefault
prim-supports-anyThe used GHC supports Any as an argument to foreign prim functions (GHC ticket #5931)Disabled
ghc_7_7Enabled

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainers' corner

For package maintainers and hackage trustees