Skip to content

Commit

Permalink
minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
bhansconnect committed Sep 17, 2024
1 parent 8305aff commit ad7be99
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crates/roc_std_heap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use std::{
};

const REFCOUNT_ONE: usize = isize::MIN as usize;
const REFCOUNT_CONSTANT: usize = 0;

/// ThreadSafeRefcountedResourceHeap is a threadsafe version of the refcounted heap that can avoid a wrapping Mutex and RefCell.
/// This is very important for dealloc performance.
Expand Down Expand Up @@ -130,7 +131,7 @@ impl<T> RefcountedResourceHeap<T> {
let offset = i * Heap::<Refcounted<T>>::node_size();
let elem_ptr = unsafe { self.0.data.as_mut_ptr().add(offset) };
let rc_ptr = elem_ptr as *mut usize;
unsafe { *rc_ptr = 0 };
unsafe { *rc_ptr = REFCOUNT_CONSTANT };
}
}
}
Expand Down

0 comments on commit ad7be99

Please sign in to comment.