Skip to content

Commit

Permalink
Impl Drop for los allocator
Browse files Browse the repository at this point in the history
  • Loading branch information
wenyuzhao committed Jul 1, 2024
1 parent 6f29430 commit 1525772
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions mallockit/src/space/large_object_space.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,15 @@ where
}
}
}

impl<S: PageSize, const MAX_CACHEABLE_SIZE: usize, const THRESHOLD_SLOP: usize> Drop
for LargeObjectAllocator<S, MAX_CACHEABLE_SIZE, THRESHOLD_SLOP>
where
[(); bins::<S>(MAX_CACHEABLE_SIZE)]: Sized,
{
fn drop(&mut self) {
if Self::CACHE_ENABLED {
self.clear_bins();
}
}
}

0 comments on commit 1525772

Please sign in to comment.