mirror of
https://github.com/rustfs/rustfs.git
synced 2026-09-08 04:58:12 +00:00
chore(deps): refresh hotpath, mimalloc, and kafka (#7135)
* chore(deps): refresh hotpath and mimalloc Co-Authored-By: heihutu <heihutu@gmail.com> Co-Authored-By: zhi22915 <qiuzgang@gmail.com> * chore(deps): bump rustfs kafka crates Co-Authored-By: heihutu <heihutu@gmail.com> Co-Authored-By: zhi22915 <qiuzgang@gmail.com> --------- Co-authored-by: zhi22915 <qiuzgang@gmail.com>
This commit is contained in:
+6
-2
@@ -14,6 +14,8 @@
|
||||
|
||||
#[cfg(all(feature = "hotpath", feature = "hotpath-alloc", not(target_os = "windows")))]
|
||||
use std::alloc::{GlobalAlloc, Layout};
|
||||
#[cfg(all(feature = "hotpath", feature = "hotpath-alloc", not(target_os = "windows")))]
|
||||
use std::ptr::NonNull;
|
||||
|
||||
#[cfg(all(feature = "hotpath", feature = "hotpath-alloc", not(target_os = "windows")))]
|
||||
#[derive(Default)]
|
||||
@@ -35,8 +37,10 @@ unsafe impl GlobalAlloc for MiMallocAllocator {
|
||||
}
|
||||
|
||||
unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) {
|
||||
// SAFETY: ptr came from this allocator and layout.size() is the original allocation size.
|
||||
unsafe { rustfs_mimalloc::MiMalloc::free_csize(ptr, layout.size()) }
|
||||
// SAFETY: ptr came from this allocator, is non-null by GlobalAlloc's
|
||||
// dealloc contract, and layout.size() is the original allocation size.
|
||||
let ptr = unsafe { NonNull::new_unchecked(ptr) };
|
||||
unsafe { rustfs_mimalloc::MiMalloc::free_csize_nonnull(ptr, layout.size()) }
|
||||
}
|
||||
|
||||
unsafe fn realloc(&self, ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8 {
|
||||
|
||||
Reference in New Issue
Block a user