package core_kernel
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=34a0288f16027c6b90e4ad16cb5cc677d7063d310faf918748ce70f1745116c0
doc/core_kernel.weak_array/Weak_array/index.html
Module Weak_array
Source
Module for dealing with weak pointers, i.e., pointers that don't prevent garbage collection of what they point to.
This module is like the OCaml standard library module of the same name, except that it requires that the values in the weak set are heap blocks.
set_exn
raises an exception if given Some x
with x
not being a heap block. This is in addition to raising exceptions on bounds violation as set
does.
Warning! blit
often takes time linear in the size of the arrays, not in the size of the range being copied. This issue is being tracked in https://github.com/ocaml/ocaml/issues/9258.
Other than that, blit
is generally preferred over get
followed by set
because, unlike get
, it doesn't have to make the value strongly-referenced. Making a value strongly-referenced, even temporarily, may result in delaying its garbage collection by a whole GC cycle.