From 591b214b234b509ebddde5c2b2f871d43fc1e248 Mon Sep 17 00:00:00 2001 From: Kunal Sareen Date: Sat, 10 May 2025 12:54:25 +1000 Subject: [PATCH] Fix `CopySpace::is_live` This commit fixes the `CopySpace::is_live` function to check if a to-space object's address is actually below the current page resource cursor. By definition, a to-space object cannot be live if it is beyond the cursor. --- src/policy/copyspace.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/policy/copyspace.rs b/src/policy/copyspace.rs index bbc66ccd4d..5e69e5729c 100644 --- a/src/policy/copyspace.rs +++ b/src/policy/copyspace.rs @@ -30,7 +30,11 @@ impl SFT for CopySpace { } fn is_live(&self, object: ObjectReference) -> bool { - !self.is_from_space() || object_forwarding::is_forwarded::(object) + if !self.is_from_space() { + object.to_raw_address() < self.pr.cursor() + } else { + object_forwarding::is_forwarded::(object) + } } #[cfg(feature = "object_pinning")]