Skip to content

Commit

Permalink
clear stale line mark state
Browse files Browse the repository at this point in the history
  • Loading branch information
tianleq committed Jan 28, 2025
1 parent 051bc74 commit d7f65f3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/policy/immix/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 2 additions & 0 deletions src/util/alloc/immix_allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,8 @@ impl<VM: VMBinding> ImmixAllocator<VM> {
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();
Expand Down

0 comments on commit d7f65f3

Please sign in to comment.