package devkit

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Devkit_core.MemorySource

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.
Sourcetype 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

    *)
}
Sourceval get_num : string -> int
Sourceval pagesize : int
Sourceval 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

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

Innovation. Community. Security.