libmimalloc3_sys/
lib.rs

1use core::ffi::*;
2use core::mem::offset_of;
3
4pub const MI_MALLOC_VERSION: u32 = 316;
5pub const __BOOL_TRUE_FALSE_ARE_DEFINED: u32 = 1;
6pub const TRUE: u32 = 1;
7pub const FALSE: u32 = 0;
8pub const MI_SMALL_WSIZE_MAX: u32 = 128;
9#[allow(non_camel_case_types)]
10pub type wchar_t = c_int;
11#[allow(non_camel_case_types)]
12pub type max_align_t = f64;
13unsafe extern "C" {
14    pub fn mi_malloc(size: usize) -> *mut c_void;
15}
16unsafe extern "C" {
17    pub fn mi_calloc(count: usize, size: usize) -> *mut c_void;
18}
19unsafe extern "C" {
20    pub fn mi_realloc(p: *mut c_void, newsize: usize) -> *mut c_void;
21}
22unsafe extern "C" {
23    pub fn mi_expand(p: *mut std::os::raw::c_void, newsize: usize) -> *mut std::os::raw::c_void;
24}
25unsafe extern "C" {
26    pub fn mi_free(p: *mut std::os::raw::c_void);
27}
28unsafe extern "C" {
29    pub fn mi_strdup(s: *const std::os::raw::c_char) -> *mut c_char;
30}
31unsafe extern "C" {
32    pub fn mi_strndup(s: *const std::os::raw::c_char, n: usize) -> *mut c_char;
33}
34unsafe extern "C" {
35    pub fn mi_realpath(fname: *const c_char, resolved_name: *mut c_char) -> *mut c_char;
36}
37unsafe extern "C" {
38    pub fn mi_malloc_small(size: usize) -> *mut c_void;
39}
40unsafe extern "C" {
41    pub fn mi_zalloc_small(size: usize) -> *mut c_void;
42}
43unsafe extern "C" {
44    pub fn mi_zalloc(size: usize) -> *mut c_void;
45}
46unsafe extern "C" {
47    pub fn mi_mallocn(count: usize, size: usize) -> *mut c_void;
48}
49unsafe extern "C" {
50    pub fn mi_reallocn(p: *mut c_void, count: usize, size: usize) -> *mut c_void;
51}
52unsafe extern "C" {
53    pub fn mi_reallocf(p: *mut c_void, newsize: usize) -> *mut c_void;
54}
55unsafe extern "C" {
56    pub fn mi_usable_size(p: *const c_void) -> usize;
57}
58unsafe extern "C" {
59    pub fn mi_good_size(size: usize) -> usize;
60}
61#[allow(non_camel_case_types)]
62pub type mi_deferred_free_fun =
63Option<unsafe extern "C" fn(force: bool, heartbeat: c_ulonglong, arg: *mut c_void)>;
64unsafe extern "C" {
65    pub fn mi_register_deferred_free(deferred_free: mi_deferred_free_fun, arg: *mut c_void);
66}
67#[allow(non_camel_case_types)]
68pub type mi_output_fun = Option<unsafe extern "C" fn(msg: *const c_char, arg: *mut c_void)>;
69unsafe extern "C" {
70    pub fn mi_register_output(out: mi_output_fun, arg: *mut c_void);
71}
72#[allow(non_camel_case_types)]
73pub type mi_error_fun = Option<unsafe extern "C" fn(err: c_int, arg: *mut c_void)>;
74unsafe extern "C" {
75    pub fn mi_register_error(fun: mi_error_fun, arg: *mut c_void);
76}
77unsafe extern "C" {
78    pub fn mi_collect(force: bool);
79}
80unsafe extern "C" {
81    pub fn mi_version() -> c_int;
82}
83unsafe extern "C" {
84    pub fn mi_stats_reset();
85}
86unsafe extern "C" {
87    pub fn mi_stats_merge();
88}
89unsafe extern "C" {
90    pub fn mi_stats_print(out: *mut c_void);
91}
92unsafe extern "C" {
93    pub fn mi_stats_print_out(out: mi_output_fun, arg: *mut c_void);
94}
95unsafe extern "C" {
96    pub fn mi_thread_stats_print_out(out: mi_output_fun, arg: *mut c_void);
97}
98unsafe extern "C" {
99    pub fn mi_options_print();
100}
101unsafe extern "C" {
102    pub fn mi_process_info(
103        elapsed_msecs: *mut usize,
104        user_msecs: *mut usize,
105        system_msecs: *mut usize,
106        current_rss: *mut usize,
107        peak_rss: *mut usize,
108        current_commit: *mut usize,
109        peak_commit: *mut usize,
110        page_faults: *mut usize,
111    );
112}
113unsafe extern "C" {
114    pub fn mi_process_init();
115}
116unsafe extern "C" {
117    pub fn mi_process_done();
118}
119unsafe extern "C" {
120    pub fn mi_thread_init();
121}
122unsafe extern "C" {
123    pub fn mi_thread_done();
124}
125unsafe extern "C" {
126    pub fn mi_malloc_aligned(size: usize, alignment: usize) -> *mut c_void;
127}
128unsafe extern "C" {
129    pub fn mi_malloc_aligned_at(size: usize, alignment: usize, offset: usize) -> *mut c_void;
130}
131unsafe extern "C" {
132    pub fn mi_zalloc_aligned(size: usize, alignment: usize) -> *mut c_void;
133}
134unsafe extern "C" {
135    pub fn mi_zalloc_aligned_at(size: usize, alignment: usize, offset: usize) -> *mut c_void;
136}
137unsafe extern "C" {
138    pub fn mi_calloc_aligned(count: usize, size: usize, alignment: usize) -> *mut c_void;
139}
140unsafe extern "C" {
141    pub fn mi_calloc_aligned_at(
142        count: usize,
143        size: usize,
144        alignment: usize,
145        offset: usize,
146    ) -> *mut c_void;
147}
148unsafe extern "C" {
149    pub fn mi_realloc_aligned(p: *mut c_void, newsize: usize, alignment: usize) -> *mut c_void;
150}
151unsafe extern "C" {
152    pub fn mi_realloc_aligned_at(
153        p: *mut c_void,
154        newsize: usize,
155        alignment: usize,
156        offset: usize,
157    ) -> *mut c_void;
158}
159#[repr(C)]
160#[derive(Debug, Copy, Clone)]
161#[allow(non_camel_case_types)]
162pub struct mi_heap_s {
163    _unused: [u8; 0],
164}
165#[allow(non_camel_case_types)]
166pub type mi_heap_t = mi_heap_s;
167unsafe extern "C" {
168    pub fn mi_heap_new() -> *mut mi_heap_t;
169}
170unsafe extern "C" {
171    pub fn mi_heap_delete(heap: *mut mi_heap_t);
172}
173unsafe extern "C" {
174    pub fn mi_heap_destroy(heap: *mut mi_heap_t);
175}
176unsafe extern "C" {
177    pub fn mi_heap_set_default(heap: *mut mi_heap_t) -> *mut mi_heap_t;
178}
179unsafe extern "C" {
180    pub fn mi_heap_get_default() -> *mut mi_heap_t;
181}
182unsafe extern "C" {
183    pub fn mi_heap_get_backing() -> *mut mi_heap_t;
184}
185unsafe extern "C" {
186    pub fn mi_heap_collect(heap: *mut mi_heap_t, force: bool);
187}
188unsafe extern "C" {
189    pub fn mi_heap_malloc(heap: *mut mi_heap_t, size: usize) -> *mut c_void;
190}
191unsafe extern "C" {
192    pub fn mi_heap_zalloc(heap: *mut mi_heap_t, size: usize) -> *mut c_void;
193}
194unsafe extern "C" {
195    pub fn mi_heap_calloc(heap: *mut mi_heap_t, count: usize, size: usize) -> *mut c_void;
196}
197unsafe extern "C" {
198    pub fn mi_heap_mallocn(heap: *mut mi_heap_t, count: usize, size: usize) -> *mut c_void;
199}
200unsafe extern "C" {
201    pub fn mi_heap_malloc_small(heap: *mut mi_heap_t, size: usize) -> *mut c_void;
202}
203unsafe extern "C" {
204    pub fn mi_heap_realloc(heap: *mut mi_heap_t, p: *mut c_void, newsize: usize) -> *mut c_void;
205}
206unsafe extern "C" {
207    pub fn mi_heap_reallocn(
208        heap: *mut mi_heap_t,
209        p: *mut c_void,
210        count: usize,
211        size: usize,
212    ) -> *mut c_void;
213}
214unsafe extern "C" {
215    pub fn mi_heap_reallocf(heap: *mut mi_heap_t, p: *mut c_void, newsize: usize) -> *mut c_void;
216}
217unsafe extern "C" {
218    pub fn mi_heap_strdup(heap: *mut mi_heap_t, s: *const c_char) -> *mut c_char;
219}
220unsafe extern "C" {
221    pub fn mi_heap_strndup(heap: *mut mi_heap_t, s: *const c_char, n: usize) -> *mut c_char;
222}
223unsafe extern "C" {
224    pub fn mi_heap_realpath(
225        heap: *mut mi_heap_t,
226        fname: *const c_char,
227        resolved_name: *mut c_char,
228    ) -> *mut c_char;
229}
230unsafe extern "C" {
231    pub fn mi_heap_malloc_aligned(
232        heap: *mut mi_heap_t,
233        size: usize,
234        alignment: usize,
235    ) -> *mut c_void;
236}
237unsafe extern "C" {
238    pub fn mi_heap_malloc_aligned_at(
239        heap: *mut mi_heap_t,
240        size: usize,
241        alignment: usize,
242        offset: usize,
243    ) -> *mut c_void;
244}
245unsafe extern "C" {
246    pub fn mi_heap_zalloc_aligned(
247        heap: *mut mi_heap_t,
248        size: usize,
249        alignment: usize,
250    ) -> *mut c_void;
251}
252unsafe extern "C" {
253    pub fn mi_heap_zalloc_aligned_at(
254        heap: *mut mi_heap_t,
255        size: usize,
256        alignment: usize,
257        offset: usize,
258    ) -> *mut c_void;
259}
260unsafe extern "C" {
261    pub fn mi_heap_calloc_aligned(
262        heap: *mut mi_heap_t,
263        count: usize,
264        size: usize,
265        alignment: usize,
266    ) -> *mut c_void;
267}
268unsafe extern "C" {
269    pub fn mi_heap_calloc_aligned_at(
270        heap: *mut mi_heap_t,
271        count: usize,
272        size: usize,
273        alignment: usize,
274        offset: usize,
275    ) -> *mut c_void;
276}
277unsafe extern "C" {
278    pub fn mi_heap_realloc_aligned(
279        heap: *mut mi_heap_t,
280        p: *mut c_void,
281        newsize: usize,
282        alignment: usize,
283    ) -> *mut c_void;
284}
285unsafe extern "C" {
286    pub fn mi_heap_realloc_aligned_at(
287        heap: *mut mi_heap_t,
288        p: *mut c_void,
289        newsize: usize,
290        alignment: usize,
291        offset: usize,
292    ) -> *mut c_void;
293}
294unsafe extern "C" {
295    pub fn mi_rezalloc(p: *mut c_void, newsize: usize) -> *mut c_void;
296}
297unsafe extern "C" {
298    pub fn mi_recalloc(p: *mut c_void, newcount: usize, size: usize) -> *mut c_void;
299}
300unsafe extern "C" {
301    pub fn mi_rezalloc_aligned(p: *mut c_void, newsize: usize, alignment: usize) -> *mut c_void;
302}
303unsafe extern "C" {
304    pub fn mi_rezalloc_aligned_at(
305        p: *mut c_void,
306        newsize: usize,
307        alignment: usize,
308        offset: usize,
309    ) -> *mut c_void;
310}
311unsafe extern "C" {
312    pub fn mi_recalloc_aligned(
313        p: *mut c_void,
314        newcount: usize,
315        size: usize,
316        alignment: usize,
317    ) -> *mut c_void;
318}
319unsafe extern "C" {
320    pub fn mi_recalloc_aligned_at(
321        p: *mut c_void,
322        newcount: usize,
323        size: usize,
324        alignment: usize,
325        offset: usize,
326    ) -> *mut c_void;
327}
328unsafe extern "C" {
329    pub fn mi_heap_rezalloc(heap: *mut mi_heap_t, p: *mut c_void, newsize: usize) -> *mut c_void;
330}
331unsafe extern "C" {
332    pub fn mi_heap_recalloc(
333        heap: *mut mi_heap_t,
334        p: *mut c_void,
335        newcount: usize,
336        size: usize,
337    ) -> *mut c_void;
338}
339unsafe extern "C" {
340    pub fn mi_heap_rezalloc_aligned(
341        heap: *mut mi_heap_t,
342        p: *mut c_void,
343        newsize: usize,
344        alignment: usize,
345    ) -> *mut c_void;
346}
347unsafe extern "C" {
348    pub fn mi_heap_rezalloc_aligned_at(
349        heap: *mut mi_heap_t,
350        p: *mut c_void,
351        newsize: usize,
352        alignment: usize,
353        offset: usize,
354    ) -> *mut c_void;
355}
356unsafe extern "C" {
357    pub fn mi_heap_recalloc_aligned(
358        heap: *mut mi_heap_t,
359        p: *mut c_void,
360        newcount: usize,
361        size: usize,
362        alignment: usize,
363    ) -> *mut c_void;
364}
365unsafe extern "C" {
366    pub fn mi_heap_recalloc_aligned_at(
367        heap: *mut mi_heap_t,
368        p: *mut c_void,
369        newcount: usize,
370        size: usize,
371        alignment: usize,
372        offset: usize,
373    ) -> *mut c_void;
374}
375unsafe extern "C" {
376    pub fn mi_heap_contains_block(heap: *mut mi_heap_t, p: *const c_void) -> bool;
377}
378unsafe extern "C" {
379    pub fn mi_heap_check_owned(heap: *mut mi_heap_t, p: *const c_void) -> bool;
380}
381unsafe extern "C" {
382    pub fn mi_check_owned(p: *const c_void) -> bool;
383}
384#[repr(C)]
385#[derive(Debug, Copy, Clone)]
386#[allow(non_camel_case_types)]
387pub struct mi_heap_area_s {
388    pub blocks: *mut c_void,
389    pub reserved: usize,
390    pub committed: usize,
391    pub used: usize,
392    pub block_size: usize,
393    pub full_block_size: usize,
394    pub heap_tag: c_int,
395}
396#[allow(clippy::unnecessary_operation, clippy::identity_op)]
397const _: () = {
398    ["Size of mi_heap_area_s"][size_of::<mi_heap_area_s>() - 56usize];
399    ["Alignment of mi_heap_area_s"][align_of::<mi_heap_area_s>() - 8usize];
400    ["Offset of field: mi_heap_area_s::blocks"][offset_of!(mi_heap_area_s, blocks) - 0usize];
401    ["Offset of field: mi_heap_area_s::reserved"][offset_of!(mi_heap_area_s, reserved) - 8usize];
402    ["Offset of field: mi_heap_area_s::committed"][offset_of!(mi_heap_area_s, committed) - 16usize];
403    ["Offset of field: mi_heap_area_s::used"][offset_of!(mi_heap_area_s, used) - 24usize];
404    ["Offset of field: mi_heap_area_s::block_size"]
405        [offset_of!(mi_heap_area_s, block_size) - 32usize];
406    ["Offset of field: mi_heap_area_s::full_block_size"]
407        [offset_of!(mi_heap_area_s, full_block_size) - 40usize];
408    ["Offset of field: mi_heap_area_s::heap_tag"][offset_of!(mi_heap_area_s, heap_tag) - 48usize];
409};
410#[allow(non_camel_case_types)]
411pub type mi_heap_area_t = mi_heap_area_s;
412#[allow(non_camel_case_types)]
413pub type mi_block_visit_fun = Option<
414    unsafe extern "C" fn(
415        heap: *const mi_heap_t,
416        area: *const mi_heap_area_t,
417        block: *mut c_void,
418        block_size: usize,
419        arg: *mut c_void,
420    ) -> bool,
421>;
422unsafe extern "C" {
423    pub fn mi_heap_visit_blocks(
424        heap: *const mi_heap_t,
425        visit_blocks: bool,
426        visitor: mi_block_visit_fun,
427        arg: *mut c_void,
428    ) -> bool;
429}
430unsafe extern "C" {
431    pub fn mi_is_in_heap_region(p: *const c_void) -> bool;
432}
433unsafe extern "C" {
434    pub fn mi_is_redirected() -> bool;
435}
436unsafe extern "C" {
437    pub fn mi_reserve_huge_os_pages_interleave(
438        pages: usize,
439        numa_nodes: usize,
440        timeout_msecs: usize,
441    ) -> c_int;
442}
443unsafe extern "C" {
444    pub fn mi_reserve_huge_os_pages_at(
445        pages: usize,
446        numa_node: c_int,
447        timeout_msecs: usize,
448    ) -> c_int;
449}
450unsafe extern "C" {
451    pub fn mi_reserve_os_memory(size: usize, commit: bool, allow_large: bool) -> c_int;
452}
453unsafe extern "C" {
454    pub fn mi_manage_os_memory(
455        start: *mut c_void,
456        size: usize,
457        is_committed: bool,
458        is_pinned: bool,
459        is_zero: bool,
460        numa_node: c_int,
461    ) -> bool;
462}
463unsafe extern "C" {
464    pub fn mi_debug_show_arenas();
465}
466unsafe extern "C" {
467    pub fn mi_arenas_print();
468}
469unsafe extern "C" {
470    pub fn mi_arena_min_alignment() -> usize;
471}
472#[allow(non_camel_case_types)]
473pub type mi_arena_id_t = *mut c_void;
474unsafe extern "C" {
475    pub fn mi_arena_area(arena_id: mi_arena_id_t, size: *mut usize) -> *mut c_void;
476}
477unsafe extern "C" {
478    pub fn mi_reserve_huge_os_pages_at_ex(
479        pages: usize,
480        numa_node: c_int,
481        timeout_msecs: usize,
482        exclusive: bool,
483        arena_id: *mut mi_arena_id_t,
484    ) -> c_int;
485}
486unsafe extern "C" {
487    pub fn mi_reserve_os_memory_ex(
488        size: usize,
489        commit: bool,
490        allow_large: bool,
491        exclusive: bool,
492        arena_id: *mut mi_arena_id_t,
493    ) -> c_int;
494}
495unsafe extern "C" {
496    pub fn mi_manage_os_memory_ex(
497        start: *mut c_void,
498        size: usize,
499        is_committed: bool,
500        is_pinned: bool,
501        is_zero: bool,
502        numa_node: c_int,
503        exclusive: bool,
504        arena_id: *mut mi_arena_id_t,
505    ) -> bool;
506}
507unsafe extern "C" {
508    pub fn mi_heap_new_in_arena(arena_id: mi_arena_id_t) -> *mut mi_heap_t;
509}
510#[allow(non_camel_case_types)]
511pub type mi_subproc_id_t = *mut c_void;
512unsafe extern "C" {
513    pub fn mi_subproc_main() -> mi_subproc_id_t;
514}
515unsafe extern "C" {
516    pub fn mi_subproc_new() -> mi_subproc_id_t;
517}
518unsafe extern "C" {
519    pub fn mi_subproc_delete(subproc: mi_subproc_id_t);
520}
521unsafe extern "C" {
522    pub fn mi_subproc_add_current_thread(subproc: mi_subproc_id_t);
523}
524unsafe extern "C" {
525    pub fn mi_abandoned_visit_blocks(
526        subproc_id: mi_subproc_id_t,
527        heap_tag: c_int,
528        visit_blocks: bool,
529        visitor: mi_block_visit_fun,
530        arg: *mut c_void,
531    ) -> bool;
532}
533unsafe extern "C" {
534    pub fn mi_heap_set_numa_affinity(heap: *mut mi_heap_t, numa_node: c_int);
535}
536unsafe extern "C" {
537    pub fn mi_heap_guarded_set_sample_rate(heap: *mut mi_heap_t, sample_rate: usize, seed: usize);
538}
539unsafe extern "C" {
540    pub fn mi_heap_guarded_set_size_bound(heap: *mut mi_heap_t, min: usize, max: usize);
541}
542unsafe extern "C" {
543    pub fn mi_thread_set_in_threadpool();
544}
545unsafe extern "C" {
546    pub fn mi_heap_new_ex(
547        heap_tag: c_int,
548        allow_destroy: bool,
549        arena_id: mi_arena_id_t,
550    ) -> *mut mi_heap_t;
551}
552unsafe extern "C" {
553    #[deprecated]
554    pub fn mi_reserve_huge_os_pages(
555        pages: usize,
556        max_secs: f64,
557        pages_reserved: *mut usize,
558    ) -> c_int;
559}
560unsafe extern "C" {
561    #[deprecated]
562    pub fn mi_collect_reduce(target_thread_owned: usize);
563}
564#[allow(non_camel_case_types)]
565pub type mi_commit_fun_t = Option<
566    unsafe extern "C" fn(
567        commit: bool,
568        start: *mut c_void,
569        size: usize,
570        is_zero: *mut bool,
571        user_arg: *mut c_void,
572    ) -> bool,
573>;
574unsafe extern "C" {
575    pub fn mi_manage_memory(
576        start: *mut c_void,
577        size: usize,
578        is_committed: bool,
579        is_pinned: bool,
580        is_zero: bool,
581        numa_node: c_int,
582        exclusive: bool,
583        commit_fun: mi_commit_fun_t,
584        commit_fun_arg: *mut c_void,
585        arena_id: *mut mi_arena_id_t,
586    ) -> bool;
587}
588unsafe extern "C" {
589    pub fn mi_arena_unload(
590        arena_id: mi_arena_id_t,
591        base: *mut *mut c_void,
592        accessed_size: *mut usize,
593        size: *mut usize,
594    ) -> bool;
595}
596unsafe extern "C" {
597    pub fn mi_arena_reload(
598        start: *mut c_void,
599        size: usize,
600        commit_fun: mi_commit_fun_t,
601        commit_fun_arg: *mut c_void,
602        arena_id: *mut mi_arena_id_t,
603    ) -> bool;
604}
605unsafe extern "C" {
606    pub fn mi_heap_reload(heap: *mut mi_heap_t, arena: mi_arena_id_t) -> bool;
607}
608unsafe extern "C" {
609    pub fn mi_heap_unload(heap: *mut mi_heap_t);
610}
611unsafe extern "C" {
612    pub fn mi_arena_contains(arena_id: mi_arena_id_t, p: *const c_void) -> bool;
613}
614pub const MI_OPTION_E_MI_OPTION_SHOW_ERRORS: mi_option_e = 0;
615pub const MI_OPTION_E_MI_OPTION_SHOW_STATS: mi_option_e = 1;
616pub const MI_OPTION_E_MI_OPTION_VERBOSE: mi_option_e = 2;
617pub const MI_OPTION_E_MI_OPTION_EAGER_COMMIT: mi_option_e = 3;
618pub const MI_OPTION_E_MI_OPTION_ARENA_EAGER_COMMIT: mi_option_e = 4;
619pub const MI_OPTION_E_MI_OPTION_PURGE_DECOMMITS: mi_option_e = 5;
620pub const MI_OPTION_E_MI_OPTION_ALLOW_LARGE_OS_PAGES: mi_option_e = 6;
621pub const MI_OPTION_E_MI_OPTION_RESERVE_HUGE_OS_PAGES: mi_option_e = 7;
622pub const MI_OPTION_E_MI_OPTION_RESERVE_HUGE_OS_PAGES_AT: mi_option_e = 8;
623pub const MI_OPTION_E_MI_OPTION_RESERVE_OS_MEMORY: mi_option_e = 9;
624pub const MI_OPTION_E_MI_OPTION_DEPRECATED_SEGMENT_CACHE: mi_option_e = 10;
625pub const MI_OPTION_E_MI_OPTION_DEPRECATED_PAGE_RESET: mi_option_e = 11;
626pub const MI_OPTION_E_MI_OPTION_ABANDONED_PAGE_PURGE: mi_option_e = 12;
627pub const MI_OPTION_E_MI_OPTION_DEPRECATED_SEGMENT_RESET: mi_option_e = 13;
628pub const MI_OPTION_E_MI_OPTION_EAGER_COMMIT_DELAY: mi_option_e = 14;
629pub const MI_OPTION_E_MI_OPTION_PURGE_DELAY: mi_option_e = 15;
630pub const MI_OPTION_E_MI_OPTION_USE_NUMA_NODES: mi_option_e = 16;
631pub const MI_OPTION_E_MI_OPTION_DISALLOW_OS_ALLOC: mi_option_e = 17;
632pub const MI_OPTION_E_MI_OPTION_OS_TAG: mi_option_e = 18;
633pub const MI_OPTION_E_MI_OPTION_MAX_ERRORS: mi_option_e = 19;
634pub const MI_OPTION_E_MI_OPTION_MAX_WARNINGS: mi_option_e = 20;
635pub const MI_OPTION_E_MI_OPTION_DEPRECATED_MAX_SEGMENT_RECLAIM: mi_option_e = 21;
636pub const MI_OPTION_E_MI_OPTION_DESTROY_ON_EXIT: mi_option_e = 22;
637pub const MI_OPTION_E_MI_OPTION_ARENA_RESERVE: mi_option_e = 23;
638pub const MI_OPTION_E_MI_OPTION_ARENA_PURGE_MULT: mi_option_e = 24;
639pub const MI_OPTION_E_MI_OPTION_DEPRECATED_PURGE_EXTEND_DELAY: mi_option_e = 25;
640pub const MI_OPTION_E_MI_OPTION_DISALLOW_ARENA_ALLOC: mi_option_e = 26;
641pub const MI_OPTION_E_MI_OPTION_RETRY_ON_OOM: mi_option_e = 27;
642pub const MI_OPTION_E_MI_OPTION_VISIT_ABANDONED: mi_option_e = 28;
643pub const MI_OPTION_E_MI_OPTION_GUARDED_MIN: mi_option_e = 29;
644pub const MI_OPTION_E_MI_OPTION_GUARDED_MAX: mi_option_e = 30;
645pub const MI_OPTION_E_MI_OPTION_GUARDED_PRECISE: mi_option_e = 31;
646pub const MI_OPTION_E_MI_OPTION_GUARDED_SAMPLE_RATE: mi_option_e = 32;
647pub const MI_OPTION_E_MI_OPTION_GUARDED_SAMPLE_SEED: mi_option_e = 33;
648pub const MI_OPTION_E_MI_OPTION_GENERIC_COLLECT: mi_option_e = 34;
649pub const MI_OPTION_E_MI_OPTION_PAGE_RECLAIM_ON_FREE: mi_option_e = 35;
650pub const MI_OPTION_E_MI_OPTION_PAGE_FULL_RETAIN: mi_option_e = 36;
651pub const MI_OPTION_E_MI_OPTION_PAGE_MAX_CANDIDATES: mi_option_e = 37;
652pub const MI_OPTION_E_MI_OPTION_MAX_VABITS: mi_option_e = 38;
653pub const MI_OPTION_E_MI_OPTION_PAGEMAP_COMMIT: mi_option_e = 39;
654pub const MI_OPTION_E_MI_OPTION_PAGE_COMMIT_ON_DEMAND: mi_option_e = 40;
655pub const MI_OPTION_E_MI_OPTION_PAGE_MAX_RECLAIM: mi_option_e = 41;
656pub const MI_OPTION_E_MI_OPTION_PAGE_CROSS_THREAD_MAX_RECLAIM: mi_option_e = 42;
657pub const MI_OPTION_E_MI_OPTION_LAST: mi_option_e = 43;
658pub const MI_OPTION_E_MI_OPTION_LARGE_OS_PAGES: mi_option_e = 6;
659pub const MI_OPTION_E_MI_OPTION_EAGER_REGION_COMMIT: mi_option_e = 4;
660pub const MI_OPTION_E_MI_OPTION_RESET_DECOMMITS: mi_option_e = 5;
661pub const MI_OPTION_E_MI_OPTION_RESET_DELAY: mi_option_e = 15;
662pub const MI_OPTION_E_MI_OPTION_ABANDONED_PAGE_RESET: mi_option_e = 12;
663pub const MI_OPTION_E_MI_OPTION_LIMIT_OS_ALLOC: mi_option_e = 17;
664#[allow(non_camel_case_types)]
665pub type mi_option_e = c_uint;
666pub use self::mi_option_e as mi_option_t;
667unsafe extern "C" {
668    pub fn mi_option_is_enabled(option: mi_option_t) -> bool;
669}
670unsafe extern "C" {
671    pub fn mi_option_enable(option: mi_option_t);
672}
673unsafe extern "C" {
674    pub fn mi_option_disable(option: mi_option_t);
675}
676unsafe extern "C" {
677    pub fn mi_option_set_enabled(option: mi_option_t, enable: bool);
678}
679unsafe extern "C" {
680    pub fn mi_option_set_enabled_default(option: mi_option_t, enable: bool);
681}
682unsafe extern "C" {
683    pub fn mi_option_get(option: mi_option_t) -> c_long;
684}
685unsafe extern "C" {
686    pub fn mi_option_get_clamp(option: mi_option_t, min: c_long, max: c_long) -> c_long;
687}
688unsafe extern "C" {
689    pub fn mi_option_get_size(option: mi_option_t) -> usize;
690}
691unsafe extern "C" {
692    pub fn mi_option_set(option: mi_option_t, value: c_long);
693}
694unsafe extern "C" {
695    pub fn mi_option_set_default(option: mi_option_t, value: c_long);
696}
697unsafe extern "C" {
698    pub fn mi_cfree(p: *mut c_void);
699}
700unsafe extern "C" {
701    pub fn mi__expand(p: *mut c_void, newsize: usize) -> *mut c_void;
702}
703unsafe extern "C" {
704    pub fn mi_malloc_size(p: *const c_void) -> usize;
705}
706unsafe extern "C" {
707    pub fn mi_malloc_good_size(size: usize) -> usize;
708}
709unsafe extern "C" {
710    pub fn mi_malloc_usable_size(p: *const c_void) -> usize;
711}
712unsafe extern "C" {
713    pub fn mi_posix_memalign(p: *mut *mut c_void, alignment: usize, size: usize) -> c_int;
714}
715unsafe extern "C" {
716    pub fn mi_memalign(alignment: usize, size: usize) -> *mut c_void;
717}
718unsafe extern "C" {
719    pub fn mi_valloc(size: usize) -> *mut c_void;
720}
721unsafe extern "C" {
722    pub fn mi_pvalloc(size: usize) -> *mut c_void;
723}
724unsafe extern "C" {
725    pub fn mi_aligned_alloc(alignment: usize, size: usize) -> *mut c_void;
726}
727unsafe extern "C" {
728    pub fn mi_reallocarray(p: *mut c_void, count: usize, size: usize) -> *mut c_void;
729}
730unsafe extern "C" {
731    pub fn mi_reallocarr(p: *mut c_void, count: usize, size: usize) -> c_int;
732}
733unsafe extern "C" {
734    pub fn mi_aligned_recalloc(
735        p: *mut c_void,
736        newcount: usize,
737        size: usize,
738        alignment: usize,
739    ) -> *mut c_void;
740}
741unsafe extern "C" {
742    pub fn mi_aligned_offset_recalloc(
743        p: *mut c_void,
744        newcount: usize,
745        size: usize,
746        alignment: usize,
747        offset: usize,
748    ) -> *mut c_void;
749}
750unsafe extern "C" {
751    pub fn mi_wcsdup(s: *const c_ushort) -> *mut c_ushort;
752}
753unsafe extern "C" {
754    pub fn mi_mbsdup(s: *const c_uchar) -> *mut c_uchar;
755}
756unsafe extern "C" {
757    pub fn mi_dupenv_s(buf: *mut *mut c_char, size: *mut usize, name: *const c_char) -> c_int;
758}
759unsafe extern "C" {
760    pub fn mi_wdupenv_s(buf: *mut *mut c_ushort, size: *mut usize, name: *const c_ushort) -> c_int;
761}
762unsafe extern "C" {
763    pub fn mi_free_size(p: *mut c_void, size: usize);
764}
765unsafe extern "C" {
766    pub fn mi_free_size_aligned(p: *mut c_void, size: usize, alignment: usize);
767}
768unsafe extern "C" {
769    pub fn mi_free_aligned(p: *mut c_void, alignment: usize);
770}
771unsafe extern "C" {
772    pub fn mi_new(size: usize) -> *mut c_void;
773}
774unsafe extern "C" {
775    pub fn mi_new_aligned(size: usize, alignment: usize) -> *mut c_void;
776}
777unsafe extern "C" {
778    pub fn mi_new_nothrow(size: usize) -> *mut c_void;
779}
780unsafe extern "C" {
781    pub fn mi_new_aligned_nothrow(size: usize, alignment: usize) -> *mut c_void;
782}
783unsafe extern "C" {
784    pub fn mi_new_n(count: usize, size: usize) -> *mut c_void;
785}
786unsafe extern "C" {
787    pub fn mi_new_realloc(p: *mut c_void, newsize: usize) -> *mut c_void;
788}
789unsafe extern "C" {
790    pub fn mi_new_reallocn(p: *mut c_void, newcount: usize, size: usize) -> *mut c_void;
791}
792unsafe extern "C" {
793    pub fn mi_heap_alloc_new(heap: *mut mi_heap_t, size: usize) -> *mut c_void;
794}
795unsafe extern "C" {
796    pub fn mi_heap_alloc_new_n(heap: *mut mi_heap_t, count: usize, size: usize) -> *mut c_void;
797}