subms-arena-allocator 0.4.0

submillisecond.com cookbook recipe - memory: subms-arena-allocator. Bump-pointer arena with chunked growth, alignment math, and reset() for per-request reuse.
Documentation
  • Coverage
  • 100%
    8 out of 8 items documented1 out of 8 items with examples
  • Size
  • Source code size: 14.86 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 299.63 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 2s Average build duration of successful builds.
  • all releases: 3s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • kdog007

Arena allocator - Rust

Bump-pointer arena with chunked growth and reset() for per-request reuse. Allocate is ~10 ns; reset is constant-time.

Part of the submillisecond.com cookbook. Zero external dependencies; std only.

Install

[dependencies]
subms-arena-allocator = "0.4"

Quickstart

cargo test --release
cargo run --example demo

Public API

  • pub struct Bump
  • pub fn new() -> Self
  • pub fn with_capacity(initial_bytes: usize) -> Self
  • pub fn alloc_copy<T: Copy>(&mut self, value: T) -> &mut T
  • pub fn alloc_raw(&mut self, layout: Layout) -> *mut u8
  • pub fn reset(&mut self)
  • pub fn total_capacity(&self) -> usize

Files

  • src/lib.rs - implementation.
  • tests/ - integration tests; correctness, edge cases, property/stress.
  • examples/demo.rs - stdout walkthrough.
  • examples/perf_main.rs - bench entry (behind the harness feature).

License

Dual-licensed under MIT OR Apache-2.0.