I have developed a certain tool using OCaml (which was extracted from Coq proofs). I want to do some experiments to empirically observe the memory consumption by this OCaml program.
However, OCaml is a garbage collected language and this makes its behavior of memory consumption somewhat unpredictable and also hard to explain. I would like to somehow tune the garbage collector so that it behaves in a more predictable, preferably eager, fashion.
Is there some way to best tune the Garbage Collector to my needs? For example, is it possible to plugin a different garbage collector into OCaml? Perhaps a more eager one, or something which uses a different mechanism, like reference counting.
One of the solutions I have found so far is to manually trigger the Garbage Collector by using Gc.minor () and Gc.major () from the Gc module. I'd appreciate other suggestions.