package core_extended

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

Malloc bindings

Allows you to set/query the behaviour of malloc. The functions in this module may not be implemented on your platform.

type mallinfo = {
  1. arena : int;
    (*

    non-mmapped space allocated from system

    *)
  2. ordblks : int;
    (*

    number of free chunks

    *)
  3. smblks : int;
    (*

    number of fastbin blocks

    *)
  4. hblks : int;
    (*

    number of mmapped regions

    *)
  5. hblkhd : int;
    (*

    space in mmapped regions

    *)
  6. usmblks : int;
    (*

    maximum total allocated space

    *)
  7. fsmblks : int;
    (*

    space available in freed fastbin blocks

    *)
  8. uordblks : int;
    (*

    total allocated space

    *)
  9. fordblks : int;
    (*

    total free space

    *)
  10. keepcost : int;
    (*

    top-most, releasable (via malloc_trim) space

    *)
}
include sig ... end
val mallinfo_of_sexp : Sexplib.Sexp.t -> mallinfo
val sexp_of_mallinfo : mallinfo -> Sexplib.Sexp.t
val bin_read_mallinfo : mallinfo Core.Bin_prot.Read.reader
val __bin_read_mallinfo__ : (int -> mallinfo) Core.Bin_prot.Read.reader
val bin_reader_mallinfo : mallinfo Core.Bin_prot.Type_class.reader
val bin_size_mallinfo : mallinfo Core.Bin_prot.Size.sizer
val bin_write_mallinfo : mallinfo Core.Bin_prot.Write.writer
val bin_writer_mallinfo : mallinfo Core.Bin_prot.Type_class.writer
val bin_shape_mallinfo : Core.Bin_prot.Shape.t
type opt =
  1. | TRIM_THRESHOLD
    (*

    Maximum amount of unused top-most memory to keep before releasing via malloc_trim in free().

    *)
  2. | TOP_PAD
    (*

    Amount of extra `padding' space to allocate or retain whenever sbrk is called.

    *)
  3. | MMAP_THRESHOLD
    (*

    Request size threshold for using mmap() to service a request. Requests of at least this size that cannot be allocated using already-existing space will be serviced via mmap.

    *)
  4. | MMAP_MAX
    (*

    Maximum number of requests to simultaneously service using mmap.

    *)
  5. | CHECK_ACTION
    (*

    ???

    *)

Malloc options

include sig ... end
val opt_of_sexp : Sexplib.Sexp.t -> opt
val sexp_of_opt : opt -> Sexplib.Sexp.t
val bin_read_opt : opt Core.Bin_prot.Read.reader
val __bin_read_opt__ : (int -> opt) Core.Bin_prot.Read.reader
val bin_size_opt : opt Core.Bin_prot.Size.sizer
val bin_write_opt : opt Core.Bin_prot.Write.writer
val bin_shape_opt : Core.Bin_prot.Shape.t
val mallinfo : (unit -> mallinfo) Core.Or_error.t

mallinfo ()

  • returns

    information on the state of malloced memory (C-heap).

val mallopt : (opt -> int -> unit) Core.Or_error.t

mallopt opt n sets malloc configuration option opt to n.

val malloc_trim : (int -> unit) Core.Or_error.t

malloc_trim n release all but n bytes of freed top-most memory back to the system.

  • raises Failure

    if unsuccessful.

val malloc_stats : (unit -> unit) Core.Or_error.t

malloc_stats () prints brief summary statistics on stderr.

OCaml

Innovation. Community. Security.