Remove the primitive functions caml_static_{alloc,free,resize}

These primitives are dangerous because they produce naked pointers
outside the OCaml heap, with a risk of "GC pointer confusion".
(After caml_free and a heap extension, the freed memory area can be
reallocated as part of the OCaml heap, causing the naked pointer to
become a bad heap pointer).

These primitives are not used anywhere in the core OCaml system
(in particular they are not exposed via the Obj module).
An OPAM-wide grep shows no uses there either.
master
Xavier Leroy 2020-06-13 18:23:08 +02:00
parent b0cd12d1c4
commit d6f949608d
1 changed files with 0 additions and 17 deletions

View File

@ -31,23 +31,6 @@
#include "caml/signals.h"
#include "caml/spacetime.h"
/* [size] is a value encoding a number of bytes */
CAMLprim value caml_static_alloc(value size)
{
return (value) caml_stat_alloc((asize_t) Long_val(size));
}
CAMLprim value caml_static_free(value blk)
{
caml_stat_free((void *) blk);
return Val_unit;
}
CAMLprim value caml_static_resize(value blk, value new_size)
{
return (value) caml_stat_resize((char *) blk, (asize_t) Long_val(new_size));
}
/* unused since GPR#427 */
CAMLprim value caml_obj_is_block(value arg)
{