Indices into the bit array were being calculated incorrectly, and went beyond
the end of the array. Sometimes this would extend into a block being used by
the system, causing very confusing behavior. Because which blocks are
allocated when depends on the exact alignment of the beginning and end of
memory, this bug can be very difficult to reproduce.
Add two debug checks that should cause panics if the bug is triggered again,
but leave them commented out.
Indices into the bit array were being calculated incorrectly, and went beyond the end of the array. Sometimes this would extend into a block being used by the system, causing very confusing behavior. Because which blocks are allocated when depends on the exact alignment of the beginning and end of memory, this bug can be very difficult to reproduce.
Add two debug checks that should cause panics if the bug is triggered again, but leave them commented out.
Thank you @cstanfill for debugging this problem!