Module Gc.For_testing

module Allocation_report : sig ... end
val measure_allocation : (Core_kernel__.Import.unit -> 'a) -> 'a * Allocation_report.t

measure_allocation f measures the words allocated by running f ()

val is_zero_alloc : (Core_kernel__.Import.unit -> _) -> Core_kernel__.Import.bool

is_zero_alloc f runs f () and returns true if it does not allocate, or false otherwise. is_zero_alloc does not allocate.

val prepare_heap_to_count_minor_allocation : Core_kernel__.Import.unit -> Core_kernel__.Import.unit

prepare_heap_to_count_minor_allocation sets up the heap so that one can subsequently measure minor allocation via:

let minor_words_before = Gc.minor_words () in
(* ... do stuff ... *)
let minor_words_after = Gc.minor_words () in
let minor_words_allocated = minor_words_after - minor_words_before in

Without calling prepare_heap_to_count_minor_allocation, the resulting count may be inaccurate.