mmapped bigarrays that have been sliced are never unmapped #7915
caml_ba_slice uses caml_ba_alloc and hence caml_ba_ops/caml_ba_finalize, even if the array you are slicing is mmapped and so it should be using caml_ba_mapped_ops/caml_ba_mapped_finalize.
When the slice is garbage collected, caml_ba_finalize either asserts-0, or does nothing (if assertions are not enabled), and in particular does not decrease the refcount on the proxy.
When the original array is garbage collected, the refcount is greater than 1, so it is not freed.
Steps to reproduce
Build and execute attached file with ocamlopt.