[Libguestfs] [PATCH libguestfs 1/2] ocaml/implicit_close test: collect all currently unreachable blocks
Richard W.M. Jones
rjones at redhat.com
Wed May 31 11:23:01 UTC 2023
... And while I'm scrawling my throughts into this thread ...
What we intend here are two slightly different operations:
(A) Free every unreachable object. That's what we want in this
specific place in the code.
(B) Provide a soft test that the OCaml heap hasn't been screwed
up because of bugs in our bindings. That's what we use eg here:
https://gitlab.com/nbdkit/libnbd/-/blob/master/ocaml/tests/test_100_handle.ml#L24
In OCaml 4 Gc.compact provides (A) and (B), in particular compaction
is quite an aggressive & costly operation that requires examining and
moving every object on the heap. In practice we found this quickly
reveals bugs in bindings.
OCaml 5 provides (A) through Gc.full_major--albeit not documented--and
doesn't seem to provide any way to do (B) as far as I can tell.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines. Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v
More information about the Libguestfs
mailing list