I don’t think there are problems with
msync, the PR probably just asks to be resurrected.
Since you are asking this question I imagine that it is not possible for you to simply create a second Bigarray with the new size with the same backing file. I think it is possible to remain compatible with the OCaml semantics (modulo possible segfaults if there are out-of-bounds accesses in your program instead of an exception, though not undefined behaviour) as follows:
- Start by reserving more virtual address space than you would eventually need
- Have a Bigarray whose length corresponds to the memory you have reserved
- Replace the mapping with fixed mappings backed by the file when you grow it
You would need to write mapping and resizing functions in C, but this should not be too complicated, you can start from the implementation of the function caml_unix_map_file.