Try redefining

This commit is contained in:
Erik Johnston
2026-05-19 16:40:33 +01:00
parent c8fbb004de
commit e2c0dcc417
3 changed files with 39 additions and 1 deletions
Generated
+1
View File
@@ -1342,6 +1342,7 @@ dependencies = [
"serde",
"serde_json",
"sha2",
"tikv-jemalloc-sys",
"tikv-jemallocator",
"tokio",
"ulid",
+7 -1
View File
@@ -65,10 +65,16 @@ once_cell = "1.18.0"
itertools = "0.14.0"
tikv-jemallocator = { version = "0.6.1", features = [
"disable_initial_exec_tls",
"unprefixed_malloc_on_supported_platforms",
] }
tikv-jemalloc-sys = { version = "0.6.1", features = [
"disable_initial_exec_tls",
] }
[build-dependencies]
blake2 = "0.10.4"
hex = "0.4.3"
rustc_version = "0.4.1"
[target.x86_64-unknown-linux-gnu]
rustflags = ["-C", "link-arg=-Wl,--version-script=export.map"]
+31
View File
@@ -90,3 +90,34 @@ impl<T> UnwrapInfallible<T> for Result<T, Infallible> {
}
}
}
#[no_mangle]
pub unsafe extern "C" fn malloc(size: usize) -> *mut std::ffi::c_void {
tikv_jemalloc_sys::malloc(size)
}
#[no_mangle]
pub unsafe extern "C" fn calloc(number: usize, size: usize) -> *mut std::ffi::c_void {
tikv_jemalloc_sys::calloc(number, size)
}
#[no_mangle]
pub unsafe extern "C" fn realloc(ptr: *mut std::ffi::c_void, size: usize) -> *mut std::ffi::c_void {
tikv_jemalloc_sys::realloc(ptr, size)
}
#[no_mangle]
pub unsafe extern "C" fn free(ptr: *mut std::ffi::c_void) {
tikv_jemalloc_sys::free(ptr)
}
#[no_mangle]
pub unsafe extern "C" fn mallctl(
name: *const std::ffi::c_char,
oldp: *mut std::ffi::c_void,
oldlenp: *mut usize,
newp: *mut std::ffi::c_void,
newlen: usize,
) -> i32 {
tikv_jemalloc_sys::mallctl(name, oldp, oldlenp, newp, newlen)
}