bomalloc 0.3.0

A fragmentation-aware experimental allocator built around address-span ownership
Documentation
//! `bomalloc` is an experimental, fragmentation-aware allocator.
//!
//! It can be used through the explicit [`BoAllocator`] API or installed as the
//! process allocator through [`BoGlobalAllocator`]. The tree carves 64 KiB Black small spans;
//! their steady owner alloc/free path is TLS-only, while cross-thread frees can
//! remain in a bounded TLS Black cache before batched shared publication.
//! OS-backed trim and chunk maintenance remain serialized.
//!
//! # Platform support
//!
//! The published crate targets x86-64 Windows and Linux on stable Rust 1.86 or
//! newer. It is experimental and has not received an independent security audit.
//!
//! # Example
//!
//! ```
//! use bomalloc::BoGlobalAllocator;
//!
//! #[global_allocator]
//! static GLOBAL: BoGlobalAllocator = BoGlobalAllocator::new();
//!
//! let values = (0_u64..1_000).collect::<Vec<_>>();
//! assert_eq!(values.len(), 1_000);
//! ```

#![deny(unsafe_op_in_unsafe_fn)]

mod allocator;
mod config;
mod error;
mod ffi;
mod global;
mod os;
mod payload_vec;
mod span;
mod stats;
mod tls;
mod topology;

pub use allocator::BoAllocator;
pub use config::{
    Config, TrimMode, DEFAULT_DEDICATED_COMMIT_CACHE_BYTES,
    MAX_ADAPTIVE_RUN_TERRITORY_EXTENSION_EXTENTS, MAX_ADAPTIVE_TERRITORY_EXTENSION_SPANS,
    MAX_BLACK_SPAN_RING_CAPACITY, MAX_LOCALITY_WINDOW_SPANS, MAX_LOCAL_MAGAZINE_CAPACITY,
    MAX_LOW_CAPACITY_PAGE_QUEUE_SPANS, MAX_RECENT_FREE_WORD_HINTS, MAX_RECENT_SPANS_PER_CLASS,
    MAX_REMOTE_CACHE_CAPACITY, MAX_RUN_LOCAL_WINDOW_CAPACITY, SIZE_CLASSES,
};
pub use error::{BoAllocError, InvariantError};
pub use ffi::{
    bo_aligned_alloc, bo_allocator_abi_version, bo_allocator_initialize, bo_allocator_stats_v1,
    bo_allocator_trim_v1, bo_allocator_validate, bo_calloc, bo_free, bo_malloc,
    bo_malloc_usable_size, bo_posix_memalign, bo_realloc, bo_reallocarray, BoCStatsV1,
    BoCTrimStatsV1,
};
pub use global::BoGlobalAllocator;
pub use stats::{StatsSnapshot, TrimStats};