aren_alloc 0.3.0

Simple allocator for small copyable objects inspired by object-pools.
Documentation
  • Coverage
  • 100%
    9 out of 9 items documented1 out of 9 items with examples
  • Size
  • Source code size: 27.76 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.77 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 9s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • DaseinPhaos/aren_alloc
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • DaseinPhaos

aren_alloc

travis Crates.io

A thread-local memory allocator backed up by the concept of object pools, used to address the memory allocation needs of arendur.

This crate is useful when

  • you want to frequently create and destroy some objects
  • these objects are copyable small ones, with size under 256 bytes
  • you want the underlying memory to be reused
  • you want a unified interface for the pool, rather than a typed one

Usage

use aren_alloc::Allocator;
#[derive(Copy, Clone)]
struct Point(u32, u32);
let allocator = Allocator::new();
let p = allocator.alloc(Point(1, 2));
assert_eq!(p.0, 1);
assert_eq!(p.1, 2);

As CoerceUnsized is supported for Pointer, compiling would require a nightly version.

License

This project is distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE, LICENSE-MIT for details.