roaring icon indicating copy to clipboard operation
roaring copied to clipboard

Example test for Frozen Bitmap fault when using Frozen Bitmaps as regular/mutable bitmaps with a read-only buffer

Open jacksonrnewhouse opened this issue 3 years ago • 4 comments

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.

jacksonrnewhouse avatar Jun 24 '22 21:06 jacksonrnewhouse

@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.

lemire avatar Jun 25 '22 14:06 lemire

This PR cannot be merged. I converted it to a draft.

lemire avatar Jun 25 '22 14:06 lemire

@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.

lemire avatar Jun 25 '22 14:06 lemire

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.

Oppen avatar Jun 25 '22 16:06 Oppen