Up

Module Control

Signature

type t = {
mutable minor_heap_size
: int ; (* The size (in words) of the minor heap. Changing this parameter will trigger a minor collection. Default: 262144 words / 1MB (32bit) / 2MB (64bit). *)
mutable major_heap_increment
: int ; (* The minimum number of words to add to the major heap when increasing it. Default: 126976 words / 0.5MB (32bit) / 1MB (64bit). *)
mutable space_overhead
: int ; (* The major GC speed is computed from this parameter. This is the memory that will be "wasted" because the GC does not immediatly collect unreachable blocks. It is expressed as a percentage of the memory used for live data. The GC will work more (use more CPU time and collect blocks more eagerly) if space_overhead is smaller. Default: 80. *)
mutable verbose
: int ; (* This value controls the GC messages on standard error output. It is a sum of some of the following flags, to print messages on the corresponding events:
  • 0x001 Start of major GC cycle.
  • 0x002 Minor collection and major GC slice.
  • 0x004 Growing and shrinking of the heap.
  • 0x008 Resizing of stacks and memory manager tables.
  • 0x010 Heap compaction.
  • 0x020 Change of GC parameters.
  • 0x040 Computation of major GC slice size.
  • 0x080 Calling of finalisation functions.
  • 0x100 Bytecode executable search at start-up.
  • 0x200 Computation of compaction triggering condition. Default: 0.
*)
mutable max_overhead
: int ; (* Heap compaction is triggered when the estimated amount of "wasted" memory is more than max_overhead percent of the amount of live data. If max_overhead is set to 0, heap compaction is triggered at the end of each major GC cycle (this setting is intended for testing purposes only). If max_overhead >= 1000000, compaction is never triggered. Default: 500. *)
mutable stack_limit
: int ; (* The maximum size of the stack (in words). This is only relevant to the byte-code runtime, as the native code runtime uses the operating system's stack. Default: 1048576 words / 4MB (32bit) / 8MB (64bit). *)
mutable allocation_policy
: int ; (* The policy used for allocating in the heap. Possible values are 0 and 1. 0 is the next-fit policy, which is quite fast but can result in fragmentation. 1 is the first-fit policy, which can be slower in some cases but can be better for programs with fragmentation problems. Default: 0. *)
}
val allocation_policy : t -> int
val set_allocation_policy : t -> int -> unit
val stack_limit : t -> int
val set_stack_limit : t -> int -> unit
val max_overhead : t -> int
val set_max_overhead : t -> int -> unit
val verbose : t -> int
val set_verbose : t -> int -> unit
val space_overhead : t -> int
val set_space_overhead : t -> int -> unit
val major_heap_increment : t -> int
val set_major_heap_increment : t -> int -> unit
val minor_heap_size : t -> int
val set_minor_heap_size : t -> int -> unit
module Fields : sig .. end
val t_of_sexp : Sexplib.Sexp.t -> t
val sexp_of_t : t -> Sexplib.Sexp.t
val bin_read_t : t Bin_prot.Read.reader
val __bin_read_t__ : (int -> t) Bin_prot.Read.reader
val bin_reader_t : t Bin_prot.Type_class.reader
val bin_size_t : t Bin_prot.Size.sizer
val bin_write_t : t Bin_prot.Write.writer
val bin_writer_t : t Bin_prot.Type_class.writer
include Core_kernel.Comparable.S with type t := t
include Comparable_intf.S_common
include Comparable_intf.Polymorphic_compare
include Polymorphic_compare_intf.Infix
type t
val (>=) : t -> t -> bool
val (<=) : t -> t -> bool
val (=) : t -> t -> bool
val (>) : t -> t -> bool
val (<) : t -> t -> bool
val (<>) : t -> t -> bool
val equal : t -> t -> bool
val compare : t -> t -> int
val min : t -> t -> t
val max : t -> t -> t
val ascending : t -> t -> int

ascending is identical to compare. descending x y = ascending y x. These are intended to be mnemonic when used like List.sort ~cmp:ascending and List.sort ~cmp:descending, since they cause the list to be sorted in ascending or descending order, respectively.

val descending : t -> t -> int
val between : t -> low:t -> high:t -> bool
val clamp_exn : t -> min:t -> max:t -> t

clamp_exn t ~min ~max returns t', the closest value to t such that between t' ~low:min ~high:max is true.

Raises if not (min <= max).

val clamp : t -> min:t -> max:t -> t Or_error.t
include Comparator.S with type t := t
type t
type comparator_witness
include Comparable_intf.Validate with type t := t
type t
val validate_lbound : min:t Maybe_bound.t -> t Validate.check
val validate_ubound : max:t Maybe_bound.t -> t Validate.check
val validate_bound : min:t Maybe_bound.t -> max:t Maybe_bound.t -> t Validate.check