Module Gperftools

module Gperftools: sig .. end

Bindings to gperftools. Monitor memory usage and control behaviour of tcmalloc.

malloc interface

val release_free_memory : unit -> unit

Release as much memory as possible to operating system

val set_memory_release_rate : float -> unit

Sets the rate at which we release unused memory to the system. Zero means we never release memory back to the system. Increase this flag to return memory faster; decrease it to return memory slower. Reasonable rates are in the range [0,10]. (Currently only implemented in tcmalloc).

val get_memory_release_rate : unit -> float

Gets the release rate. Returns a value < 0 if unknown.

exception Invalid_property of string
val set_numeric_property : string -> int -> unit
val get_numeric_property : string -> int
val known_properties : string list

Some currently useful properties :

val version : unit -> string * int * int * string

Heap profiler

val heap_profiler_start : string -> unit
val is_heap_profiler_running : unit -> bool
val heap_profiler_stop : unit -> unit
val heap_profiler_dump : string -> unit
val get_heap_profile : unit -> string