Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
libxl: ocaml: make Val_defbool GC-proof
In order to avoid newly created OCaml values from being GC'ed, they must be registered as roots with the GC, before an iteration of the GC may happen. The Val_* functions potentially allocate new values on the OCaml heap, and may trigger an iteration of the OCaml GC. The way to register a value with the GC is to assign it to a variable declared with a CAMLparam or CAMLlocal macro, which put the value into a struct that can be reached from a GC root. This leads to slightly weird looking C code, but avoids hard to find segfaults. Signed-off-by: Rob Hoes <[email protected]> Acked-by: David Scott <[email protected]> Acked-by: Ian Campbell <[email protected]>
- Loading branch information