2 releases

0.1.1 May 9, 2020
0.1.0 May 4, 2020

#739 in Memory management

MIT/Apache

22KB
257 lines

Ruyi Slab

release license crates.io docs

An object based allocator backed by a contiguous growable array of slots.

The slab allocator pre-allocates memory for objects of same type so that it reduces fragmentation caused by allocations and deallocations. When allocating memory for an object, it just finds a free (unused) slot, marks it as used, and returns the index of the slot for later access to the object. When freeing an object, it just adds the slot holding the object to the list of free (unused) slots after dropping the object.

No-std Support

To use ruyi-slab without the Rust standard library but with a memory allocator:

[dependencies]
ruyi-slab = { version = "0.1", default-features = false }

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

No runtime deps

Features