Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
two questions for keeping harmony (with the garbage collector)
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Hendrik Tews <tews@t...>
Subject: two questions for keeping harmony (with the garbage collector)
Dear all,

could somebody knowledgeable please comment on the following two

1. About rule 1: CAMLparam / CAMLreturn can be ommitted in the
   following cases:

   a) there is no value in the function that is a pointer to a
      block inside the heap.

   b) no allocation will take place between the start and the end
      of the function. (Really? Even in the presence of threads?)

2. I believe rule 2 (register with CAMLlocal) must be extended to
   intermediate values. Consider for instance

      value f(...);
      value g(...);

      h(f(...), g(...));

   Assuming right to left evaluation, this will break if the
   garbage collector is called inside f, because the value
   returned by g is not registered as a root.

   However, the following is save:


   because h2 will register the value before any allocation can