[gclist] Collecting the collector?
Thu, 21 Oct 1999 16:55:56 -0700
I don't know enough about OCaml, and a lot of this will depend on the
How does the OCaml system get its memory?
Was our collector compiled to intercept malloc calls, if indeed
that's what OCaml uses to get its heap? If so, are malloc'ed objects
treated as collectable or uncollectable?
Presumably there are no external references into the OCaml heap, but there
refrences out of it?
I would guess that you can arrange for references out of the OCaml heap to
treated safely. But if the conservative collector scans the whole OCaml
it will also scan dead objects in the OCaml heap, which is likely to result
spurious object retention.
In general, I'm of the opinion that multiple collectors in the same address
space are rarely a good idea. They're only slightly safer than using
multiple thread libraries in the same address space.
If pointers between heaps are sufficiently constrained,
you may be OK. If they're not, it's fundamentally hard to deal with garbage
cycles between heaps while keeping the collector performance predictable.
From: Michael Hicks [mailto:firstname.lastname@example.org]
Sent: Thursday, October 21, 1999 1:22 PM
Subject: [gclist] Collecting the collector?
I've addressed this mail both to the caml-list and the gclist as both
communities presumably could shed light on this area.
I have some code written in OCaml that I've exported to .a file (using the
standard procedure outlined in the OCaml manual, including using
-output-obj); this .a file will obviously include the OCaml runtime system,
and thus its precise collector. I'm linking this .a file with a C program
that has its own garbage collector, the Hans-Demers-Weiser conservative
I'm wondering if anyone has any stories from doing something of this sort
before, or could at least speculate on how the two collectors will interact.
I'm presuming that the OCaml collector will be "contained" within the area
governed by the conservative collector, and so that potential mishaps will
arise from the Caml collector doing something pointer unsafe, but that the
conservative collector will not do anything screw up the OCaml one (which
operates only on the Caml code contained in the .a file, and not the rest fo
the C program).
Thanks in advance,
Ph.D. Candidate, the University of Pennsylvania
"Conversion is something momentary; sanctification is the work of a
-- J. Escriva, "Christ Is Passing By"