[Gc] Heap traversal

Ludovic Courtès ludo at gnu.org
Fri Oct 2 01:54:42 PDT 2009


The former GC of Guile provided information about the (approximate)
number of live objects of each data type:

--8<---------------cut here---------------start------------->8---
guile> (pp (gc-live-object-stats))
(("dynamic-state" . 2)
 ("complex number" . 7)
 ("thread" . 1)
 ("frame" . 19)
 ("macro" . 72)
 ("srcprops" . 2898)


 ("cons (non-immediate car)" . 41614)
 ("jmpbuffer" . 1))
--8<---------------cut here---------------end--------------->8---

With libgc, heap traversal can be done with ‘GC_apply_to_all_blocks ()’.
This is what GCJ does

The problem is that ‘GC_apply_to_all_blocks ()’, ‘struct hblk’, and the
macros and functions that manipulate blocks and block headers are all

What would be the best way to expose just enough of these internals so
that one can write this kind of heap traversing code?


More information about the Gc mailing list