package devkit

  1. Overview
  2. Docs

Memory reporting - GC and OS, optionally malloc

General background:

  • VSZ is not very intersting, this is the amount of memory which is mapped to the process address space. It's not really memory use, only the amount of memory the process can access without triggering a segfault.
  • RSS is resident set size: this is the real world data. It's tracked by kernel and is the amount of memory currently allocated to this process. Most of the time this is what you want to look at.
  • Malloc stats: those are metrics tracked by C malloc (jemalloc, tcmalloc, glibc, etc).
  • size is basically like VSZ but from malloc point of view. That is it does not include mmap files for instance.
  • used is basically RSS from malloc point of view.
  • heap is the sum of all currently malloced values for which free had not been called. So this is what application requested, not including metadata, cache, etc
  • Gc stats are one level above and are tracked by ocaml gc. e.g. heap is the total size allocate for ocaml program. See Gc module documentation for more details.
val log : Log.logger
type t = {
  1. rss : int;
    (*

    resident set size

    *)
  2. vsize : int;
    (*

    virtual memory size

    *)
  3. nr_maps : int;
    (*

    number of VM mappings

    *)
  4. swap_used : int;
    (*

    used swap size

    *)
}
val get_num : string -> int
val pagesize : int
val get_vm_info : ?swap:bool -> unit -> t
  • parameter swap

    whether to compute swap used, can be slow (many seconds), default false

  • returns

    virtual memory info

val show_vm_info : unit -> string
val show_gc_heap : ?st:Gc.stat -> unit -> string
val show_gc_info : unit -> string
val show_lwt_info : unit -> string
val show_crt_info : (unit -> string) ref
val malloc_release : (unit -> unit) ref
val reclaim_s : unit -> string
val reclaim : unit -> unit
val reclaim_silent : unit -> unit
val add_stats : (unit -> unit) -> unit
val new_stats : (unit -> string) -> unit
val log_stats : unit -> unit
val get_stats : unit -> string list
val show_global_reachable : unit -> string
val track_global : string -> 'a -> unit
val show_c_info : unit -> string
val show_all_info : unit -> string list
val log_all_info : unit -> unit
OCaml

Innovation. Community. Security.