Skip to main content

Crate acid_alloc

Crate acid_alloc 

Source
Expand description

Bare-metal allocators.


This crate provides allocators that are suitable for use on bare metal or with low-level allocation facilities like mmap(2)/brk(2).

§Allocators

The following allocators are available:

  • Buddy, a binary-buddy allocator. O(log2levels) worst-case allocation and deallocation. Supports splitting and coalescing blocks by powers of 2. Good choice for periodic medium-to-large allocations.
  • Bump, a bump allocator. O(1) allocation. Extremely fast to allocate and flexible in terms of allocation layout, but unable to deallocate individual items. Good choice for allocations that will never be deallocated or that will be deallocated en masse.
  • Slab, a slab allocator. O(1) allocation and deallocation. All allocated blocks are the same size, making this allocator a good choice when allocating many similarly-sized objects.

§Features

All allocators provided by this crate are available in a #![no_std], #![cfg(no_global_oom_handling)] environment. Additional functionality is available when enabling feature flags:

Flag Default? Requires nightly? Description
sptr Yes No Uses the sptr polyfill for Strict Provenance.
unstable No Yes Exposes constructors for allocators backed by implementors of the unstable Allocator trait, and enables the internal use of nightly-only Rust features. Obviates sptr.
alloc No No Exposes constructors for allocators backed by the global allocator.

Modules§

buddysptr or unstable
Binary-buddy allocation.
bumpsptr or unstable
Bump allocation.
slabsptr or unstable
Slab allocation.

Structs§

Buddysptr or unstable
A binary-buddy allocator.
Bumpsptr or unstable
A bump allocator.
Rawsptr or unstable
A marker type indicating that an allocator is backed by raw pointers.
Slabsptr or unstable
A slab allocator.
AllocErrorExperimentalsptr or unstable
The AllocError error indicates an allocation failure that may be due to resource exhaustion or to something wrong when combining the given input arguments with this allocator.
GlobalExperimental(alloc) and unstable and (sptr or unstable)
The global memory allocator.

Enums§

AllocInitErrorsptr or unstable
The error type for allocator constructors.

Traits§

BackingAllocatorsptr or unstable
Types which provide memory which backs an allocator.