Crates.io | arena-rs |
lib.rs | arena-rs |
version | 0.1.1 |
source | src |
created_at | 2019-12-05 20:24:44.120817 |
updated_at | 2019-12-05 20:42:44.406468 |
description | An arena memory pool for fast heap allocations and dealocations |
homepage | https://github.com/BrokenLamp/Arena-rs |
repository | https://github.com/BrokenLamp/Arena-rs |
max_upload_size | |
id | 186739 |
size | 5,297 |
An arena memory pool for fast Rust heap allocations and dealocations.
This allows data to be allocated instantly and destroyed in batches.
let mut arena = Arena::new(1024 /* size in bytes*/);
let value = arena.alloc(17)?;
assert_eq!(*value, 17);
{
let arena = Arena::new(1024);
} // <- All data in arena is deallocated here
let arena = Arena::new(1024);
let value = arena.alloc(17)?;
move_arena(arena);
println!("{}", *value); // <- Compiler Error
// The arena was destroyed when we gave it to `move_arena`
// so we cannot use any data it gave to us