Skip to main content

Module alloc

Module alloc 

Source
Expand description

Memory allocator trait and concrete implementations.

This module forms the allocation layer of the zigzag crate. All collections in crate::collections are parameterised over an allocator::Allocator reference, so the concrete allocator type can be chosen at construction time without runtime polymorphism overhead.

§Available Allocators

TypeModuleUse case
system::SystemAllocatorsystemGeneral-purpose, delegates to posix_memalign / _aligned_malloc
bump::BumpAllocatorbumpFast linear allocation from a static buffer; no individual free
arena::ArenaAllocatorarenaPer-block allocation with bulk free; useful for request-scoped data
counting::CountingAllocatorcountingTransparent wrapper that records allocation statistics
pool::PoolAllocatorpoolFixed-size object pool with lock-free alloc / dealloc

Modules§

allocator
Core allocator abstraction.
arena
Block-based arena allocator with bulk deallocation.
bump
Lock-free bump (linear) allocator.
counting
Instrumented allocator wrapper for diagnostics and testing.
pool
Fixed-size object pool allocator.
system
System allocator backed by the OS memory-management API.