mimalloc_rust_sys/
extended_functions.rs

1use cty::{c_char, c_int, c_ulonglong, c_void};
2// Doc: https://microsoft.github.io/mimalloc/group__malloc.html
3pub const MI_SMALL_SIZE_MAX: usize = 128 * core::mem::size_of::<*mut c_void>();
4pub type mi_deferred_free_fun =
5    Option<unsafe extern "C" fn(force: bool, heartbeat: c_ulonglong, arg: *mut c_void)>;
6pub type mi_output_fun = Option<unsafe extern "C" fn(msg: *const c_char, arg: *mut c_void)>;
7pub type mi_error_fun = Option<unsafe extern "C" fn(code: c_int, arg: *mut c_void)>;
8extern "C" {
9    pub fn mi_collect(force: bool);
10    pub fn mi_good_size(size: usize) -> usize;
11    pub fn mi_is_in_heap_region(p: *const c_void) -> bool;
12    pub fn mi_malloc_small(size: usize) -> *mut c_void;
13    pub fn mi_process_info(
14        elapsed_msecs: *mut usize,
15        user_msecs: *mut usize,
16        system_msecs: *mut usize,
17        current_rss: *mut usize,
18        peak_rss: *mut usize,
19        current_commit: *mut usize,
20        peak_commit: *mut usize,
21        page_faults: *mut usize,
22    );
23    pub fn mi_register_deferred_free(out: mi_deferred_free_fun, arg: *mut c_void);
24    pub fn mi_register_error(out: mi_error_fun, arg: *mut c_void);
25    pub fn mi_register_output(out: mi_output_fun, arg: *mut c_void);
26    pub fn mi_reserve_huge_os_pages_at(
27        pages: usize,
28        numa_node: c_int,
29        timeout_msecs: usize,
30    ) -> c_int;
31    pub fn mi_reserve_huge_os_pages_interleave(
32        pages: usize,
33        numa_node: c_int,
34        timeout_msecs: usize,
35    ) -> c_int;
36    pub fn mi_stats_print(_: *mut c_void);
37    pub fn mi_stats_print_out(out: mi_output_fun, arg: *mut c_void);
38    pub fn mi_stats_reset();
39    pub fn mi_stats_merge();
40    pub fn mi_thread_init();
41    pub fn mi_thread_done();
42    pub fn mi_thread_stats_print_out(out: mi_output_fun, arg: *mut c_void);
43    pub fn mi_usable_size(p: *const c_void) -> usize;
44    pub fn mi_zalloc_small(size: usize) -> *mut c_void;
45}