ghc-heap-view: Extract the heap representation of Haskell values and thunks
This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.
Warnings:
- 'ghc-options: -O0' is not needed. Use the --disable-optimization configure flag.
- Declared and used flag sets differ: prim-supports-any /= .
This library provides functions to introspect the Haskell heap, for example to investigate sharing and lazy evaluation. As this is tied to the internals of the compiler, it only works with specific versions. This version supports, GHC 8.6. For older GHC versions see ghc-heap-view-0.5.10.
It has been inspired by (and taken code from) the vacuum package and the GHCi debugger, but also allows to investigate 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
Versions | 0.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, 0.5.4, 0.5.6, 0.5.7, 0.5.8, 0.5.9, 0.5.10, 0.5.11, 0.6.0, 0.6.0, 0.6.1, 0.6.2, 0.6.3, 0.6.4, 0.6.4.1 |
---|---|
Change log | None available |
Dependencies | base (>=4.12 && <4.13), binary, bytestring (>=0.10), containers, ghc-heap, template-haskell, transformers [details] |
License | BSD-3-Clause |
Copyright | 2012-2019 Joachim Breitner |
Author | Joachim Breitner, Dennis Felsing |
Maintainer | Joachim Breitner <mail@joachim-breitner.de> |
Category | Debug, GHC |
Bug tracker | https://github.com/nomeata/ghc-heap-view |
Source repo | head: git clone git://git.nomeata.de/ghc-heap-view.git(Cabal) |
Uploaded | by JoachimBreitner at 2019-07-25T09:41:58Z |
Modules
[Index] [Quick Jump]
Flags
Automatic Flags
Name | Description | Default |
---|---|---|
prim-supports-any | The used GHC supports Any as an argument to foreign prim functions (GHC ticket #5931) | Disabled |
Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info
Downloads
- ghc-heap-view-0.6.0.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
Package maintainers
For package maintainers and hackage trustees