module Heap_block:sig..end
Some examples of values that are not heap-allocated are integers, constant constructors, booleans, the empty array, the empty list, the unit value. The exact list of what is heap-allocated or not is implementation-dependent. Some constant values can be heap-allocated but never deallocated during the lifetime of the program, for example a list of integer constants; this is also implementation-dependent. You should also be aware that compiler optimizations may duplicate some immutable values, for example floating-point numbers when stored into arrays; thus they can be finalized and collected while another copy is still in use by the program.
The results of calling String.make, String.create, Array.make, and
Pervasives.ref are guaranteed to be heap-allocated and non-constant except when the
length argument is 0.
type'at = private'a
val create : 'a -> 'a t optioncreate v returns Some t if v is a heap block, where t is physically equal
to vval create_exn : 'a -> 'a tval value : 'a t -> 'avalue t returns the value that is physically equal to tval bytes : 'a t -> intbytes t returns the number of bytes on the heap taken by heap block t, including
the header. This is just the space for the single block, not anything it points
to.val sexp_of_t : ('a -> Sexplib.Sexp.t) -> 'a t -> Sexplib.Sexp.tcreate v returns Some t if v is a heap block, where t is physically equal
to vvalue t returns the value that is physically equal to tbytes t returns the number of bytes on the heap taken by heap block t, including
the header. This is just the space for the single block, not anything it points
to.