We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
free_offset
1 parent aea6945 commit d8dbbe0Copy full SHA for d8dbbe0
src/allocator.rs
@@ -198,6 +198,15 @@ impl Allocator {
198
pub unsafe fn free(&self, ptr: NonNull<u8>) {
199
// SAFETY: The pointer is assumed to be valid and allocated by this allocator.
200
let offset = unsafe { self.offset(ptr) };
201
+ self.free_offset(offset);
202
+ }
203
+
204
+ /// Free a block of memory previously allocated by this allocator.
205
+ ///
206
+ /// # Safety
207
+ /// - The `offset` must be a valid offset within the memory allocated by this allocator.
208
+ /// - The `offset` must not have been freed before.
209
+ pub unsafe fn free_offset(&self, offset: usize) {
210
let allocation_indexes = self.find_allocation_indexes(offset);
211
212
// Check if the slab is assigned to this worker.
0 commit comments