Reputation: 18726
The OCaml User's Manual version 4.11 states:
20.2.3 Pointers outside the heap
In earlier versions of OCaml, it was possible to use word-aligned pointers to addresses outside the heap as OCaml values, just by casting the pointer to type value. Starting with OCaml 4.11, this usage is deprecated and will stop being supported in OCaml 5.00.
What does stop being supported mean? Performance loss? Warnings? Program crashes?
My app has a lot of constant data. A lot.
To help reduce major GC costs, I am considering deep-copying said data out of the OCaml heap to some grow-only/never-collected memory of my own, backed by hugepages. (The data is not constant at compile-time, but once the program is started.)
Does the above imply that my approach will stop working with future OCaml releases?
Upvotes: 0
Views: 142
Reputation: 18892
Programs that use out-of-heap pointers (to not well formed OCaml values) crash in the no-naked-pointer mode of the compiler. Multicore OCaml will only support this no-naked pointer mode.
Citing the manual:
A correct way to manipulate pointers to out-of-heap blocks from OCaml is to store those pointers in OCaml blocks with tag Abstract_tag or Custom_tag, then use the blocks as the OCaml values.
Upvotes: 2