Expand description
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);Structs§
- BoAllocator
- BoCStats
V1 - Stable version-1 statistics layout mirrored by
include/bomalloc.h. - BoCTrim
Stats V1 - Stable version-1 trim-result layout mirrored by
include/bomalloc.h. - BoGlobal
Allocator - A stable
GlobalAllocadapter for using bomalloc as Rust’s process allocator. - Config
- Invariant
Error - Stats
Snapshot - Trim
Stats
Enums§
Constants§
- 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
Functions§
- bo_
aligned_ alloc - bo_
allocator_ abi_ version - bo_
allocator_ initialize - bo_
allocator_ ⚠stats_ v1 - Writes the version-1 allocator statistics structure.
- bo_
allocator_ ⚠trim_ v1 - Trims the C allocator and writes the version-1 result structure.
- bo_
allocator_ validate - bo_
calloc - bo_free⚠
- Releases a pointer returned by bomalloc’s C allocation family.
- bo_
malloc - bo_
malloc_ ⚠usable_ size - Returns the writable byte capacity of a C ABI allocation.
- bo_
posix_ ⚠memalign - Stores an aligned allocation in
outputusing POSIX argument rules. - bo_
realloc ⚠ - Resizes an allocation while preserving the common requested prefix.
- bo_
reallocarray ⚠ - Overflow-checked array form of
bo_realloc.