Hi,

the runtime has recently seen some improvements for keeping track of memory resources on the external heap, e.g. `caml_alloc_custom_mem`.  Though we can now tell the GC the exact size on the external heap that custom values consume at allocation time, we also need to keep track of values whose memory consumption may change over their lifetime.

I've seen the new functions `caml_alloc_dependent_memory` and `caml_free_dependent_memory`.  They are not mentioned anywhere in the manual, but judging from the comment in their implementation, they appear to address the above mentioned problem.

Is it the correct intended use if I keep track of the size of a custom value at allocation time and, if it changes later, to pass the size difference to `caml_alloc_dependent_memory` if it is positive (i.e. the value grew) and its absolute value to `caml_free_dependent_memory` if it is negative (i.e. the value shrank)?

Best regards,
Markus

--
Markus Mottl        http://www.ocaml.info        markus.mottl@gmail.com