Private.Heap
val create : int -> _ t
create n
is a heap that holds at most n
elements.
alloc t a ~extra_data
adds the value a
to t
and returns a pointer to that value, or raises Invalid_argument
if no extra space can be created for t
, or t
has already been release
d.
free t p
returns the element referenced by p
and removes it from the heap. Has undefined behaviour if p
has already been freed.
val in_use : 'a t -> int
in_use t
is the number of entries currently allocated.
val release : _ t -> unit
release t
marks t
as unusable. Future operations on it will fail. t
must be idle.