Example test for Frozen Bitmap fault when using Frozen Bitmaps as regular/mutable bitmaps with a read-only buffer
This is a test that should not pass but does, as it asserts a panic exactly when FrozenBitmaps and MMap is used. @a392n328 helped me diagnose these issues.
@Oppen Could you take a look?
Users are reminded that the frozen support in roaring is experimental. It has minimal testing, and there are no tests with mutation over frozen bitmaps. The frozen format was designed for immutable bitmaps (that you just access without modifying). Using frozen bitmaps as regular bitmaps is an extension.
This PR cannot be merged. I converted it to a draft.
@jacksonrnewhouse How sure are you that the byte array you get from the memory map is never written to when you mutate the bitmap? Your byte[] has to be read-only.
As @lemire pointed out, frozen bitmaps are not meant to be modified. The name attempts to make that clear. It could maybe handle that better or behave as CoW, but that's arguably a bad idea, as you'd potentially be duplicating memory use and inducing a leak. The idea of frozen bitmaps is to have an optimized version of read only bitmaps (in particular one that is compatible with CRoaring).
I'll look into it with more detail at night.