diff --git a/src/policy/immix/block.rs b/src/policy/immix/block.rs index 85ed76ddef..ad6bc12de4 100644 --- a/src/policy/immix/block.rs +++ b/src/policy/immix/block.rs @@ -247,7 +247,11 @@ impl Block { if prev_line_is_marked { holes += 1; } - + // We need to clear the line mark state at least twice in every 128 GC + // otherwise, the line mark state of the last GC will stick around + if line_mark_state > Line::MAX_MARK_STATE - 2 { + line.mark(0); + } #[cfg(feature = "immix_zero_on_release")] crate::util::memory::zero(line.start(), Line::BYTES); diff --git a/src/util/alloc/immix_allocator.rs b/src/util/alloc/immix_allocator.rs index abff840937..56eab251d0 100644 --- a/src/util/alloc/immix_allocator.rs +++ b/src/util/alloc/immix_allocator.rs @@ -298,6 +298,8 @@ impl ImmixAllocator { block.start(), block.end() ); + // Bulk clear stale line mark state + Line::MARK_TABLE.bzero_metadata(block.start(), Block::BYTES); if self.request_for_large { self.large_bump_pointer.cursor = block.start(); self.large_bump_pointer.limit = block.end();