Skip to main content

regorus_mimalloc/
lib.rs

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4#[cfg(not(any(target_family = "wasm")))]
5pub mod mimalloc;
6
7#[cfg(feature = "allocator-memory-limits")]
8#[cfg(not(any(target_family = "wasm")))]
9pub use mimalloc::{
10    allocation_stats_snapshot, current_thread_allocation_stats, global_allocation_stats_snapshot,
11    GlobalAllocationStats, ThreadAllocationStats,
12};
13
14#[cfg(feature = "allocator-memory-limits")]
15#[cfg(not(any(target_family = "wasm")))]
16pub mod limits;
17
18/// Declare a global allocator if the platform supports it.
19#[macro_export]
20macro_rules! assign_global {
21    () => {
22        #[cfg(not(any(target_family = "wasm")))]
23        #[global_allocator]
24        static GLOBAL: mimalloc::mimalloc::Mimalloc = mimalloc::mimalloc::Mimalloc;
25    };
26}