package ocaml-base-compiler
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=776006e6f0b9bcfb6d9d74381c588e587432ca85562fde93bb80472a5145b028
doc/stdlib/Stdlib/Obj/index.html
Module Stdlib.Obj
Source
Operations on internal representations of values.
Not for the casual user.
Computes the total size (in words, including the headers) of all heap blocks accessible from the argument. Statically allocated blocks are excluded, unless the runtime system was configured with --disable-naked-pointers
.
When using flambda:
set_field
MUST NOT be called on immutable blocks. (Blocks allocated in C stubs, or with new_block
below, are always considered mutable.)
The same goes for set_double_field
and set_tag
. However, for set_tag
, in the case of immutable blocks where the middle-end optimizers never see code that discriminates on their tag (for example records), the operation should be safe. Such uses are nonetheless discouraged.
For experts only: set_field
et al can be made safe by first wrapping the block in Sys.opaque_identity
, so any information about its contents will not be propagated.