| Crates.io | memapi |
| lib.rs | memapi |
| version | 0.17.0 |
| created_at | 2025-05-10 01:04:44.189039+00 |
| updated_at | 2025-08-11 02:53:29.745725+00 |
| description | A no_std-friendly memory allocation interface for raw buffers, with improved error reporting. |
| homepage | |
| repository | https://github.com/echohumm/memapi |
| max_upload_size | |
| id | 1667960 |
| size | 258,066 |
A no_std-friendly memory allocation interface for managing raw buffers, suitable for use in collections.
MSRV: 1.56
MSRV with extra_const feature: 1.61
MSRV with c_str feature:
MSRV with extra_extra_const feature: 1.83
MSRV with stats_file_lock feature: 1.89
stats)nightly)
specialization)clone_to_uninit)metadata)sized_hierarchy)c_str) (MSRV: 1.64)extra_const) (MSRV: 1.61)extra_extra_const) (MSRV: 1.83)AllocErrorjemalloc)mimalloc)no_std compatibleresize_in_place)alloc_ext)alloc_slice)std support (feature: std)unstable_util)Add to your Cargo.toml:
[dependencies]
memapi = "0.15.0"
Or, the recommended way:
[features]
allocator_api = ["memapi/nightly"]
[dependencies]
memapi = "0.15.0"
| Benchmark | Base (ns) | Crate (ns) | Ratio | Δ vs base |
|---|---|---|---|---|
| alloc | 4.2217 | 4.3979 | 1.0417× | 4.17% slower |
| alloc_default |
3.9590 | 4.4648 | 1.1277× | 12.77% slower |
| alloc_write |
7.5617 | 4.2021 | 0.5557× | 44.43% faster |
| alloc_filled_1k | 23.2630 | 28.5900 | 1.2288× | 22.88% slower |
| alloc_patterned_2k | 840.0900 | 836.9500 | 0.9963× | 0.37% faster |
| grow_filled_1k_to_4k | 104.9400 | 93.9140 | 0.8950× | 10.50% faster |
| realloc_filled_4k_to_1k | 81.0100 | 72.2300 | 0.8918× | 10.82% faster |
| dealloc_typed |
4.1694 | 4.5512 | 1.0916× | 9.16% slower |
| zero_and_dealloc_8k | 102.8900 | 151.5100 | 1.4727× | 47.27% slower |
black_box everywhere to minimize optimizer tomfoolery, but
this is inevitable.This crate works without the Rust standard library. It relies on alloc from the core distribution.
cargo doc --open with feature flagsLicensed under Apache-2.0 OR MIT. See LICENSE-APACHE and LICENSE-MIT.