package mirage-solo5
Library
Module
Module type
Parameter
Class
Class type
Memory management operations.
type stat = {
heap_words : int;
(*total number of words allocatable on the heap.
*)live_words : int;
(*number of live (i.e. allocated) words on the heap.
*)stack_words : int;
(*number of words in use by the program stack. This includes any space reserved by a stack guard.
*)free_words : int;
(*number of free (i.e. allocatable) words on the heap.
*)
}
Memory allocation statistics. Units are the system word size, as used by the OCaml stdlib Gc module.
val stat : unit -> stat
stat ()
returns memory allocation statistics. This uses mallinfo and walks over the entire heap. This call is slower than quick_stat
.
val quick_stat : unit -> stat
quick_stat ()
returns memory allocation statistics. This call uses a precomputed value. This call is cheaper than stat
, but the returned values may not be completely accurate.
trim ()
release free memory from the heap (may update the value returned by quick_stat
)
val metrics :
?quick:bool ->
tags:'a Metrics.Tags.t ->
unit ->
('a, unit -> Metrics.Data.t) Metrics.src
metrics ~quick ~tags
is a metrics source calling quick_stat
(unless quick
is set to false
) or stat
. By default, this metrics source is registered with Metrics_lwt.periodically
(with quick
set to true
.