Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
Signed-off-by: Calvin Neo <[email protected]>
  • Loading branch information
CalvinNeo committed Dec 11, 2024
1 parent 833906c commit a1f16b8
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions proxy_components/proxy_ffi/src/jemalloc_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ pub fn get_malloc_stats() -> String {
buffer: Mutex::new(String::new()),
};

// Use Json format.
let c_str = std::ffi::CString::new("J").unwrap();
let ops_str = c_str.as_ptr() as *const std::os::raw::c_char;

unsafe {
// See unprefixed_malloc_on_supported_platforms in tikv-jemalloc-sys.
#[cfg(any(test, feature = "testexport"))]
Expand All @@ -157,7 +161,7 @@ pub fn get_malloc_stats() -> String {
_rjem_malloc_stats_print(
Some(write_to_string),
&context as *const _ as *mut c_void,
std::ptr::null(),
ops_str,
);
#[cfg(not(any(
target_os = "android",
Expand All @@ -167,7 +171,7 @@ pub fn get_malloc_stats() -> String {
malloc_stats_print(
Some(write_to_string),
&context as *const _ as *mut c_void,
std::ptr::null(),
ops_str,
);
}
}
Expand All @@ -181,7 +185,7 @@ pub fn get_malloc_stats() -> String {
malloc_stats_print(
Some(write_to_string),
&context as *const _ as *mut c_void,
std::ptr::null(),
ops_str,
);
}
#[cfg(not(feature = "external-jemalloc"))]
Expand All @@ -196,7 +200,7 @@ pub fn get_malloc_stats() -> String {
malloc_stats_print(
Some(write_to_string),
&context as *const _ as *mut c_void,
std::ptr::null(),
ops_str,
);
}
}
Expand Down

0 comments on commit a1f16b8

Please sign in to comment.