Crates.io | umm-malloc |
lib.rs | umm-malloc |
version | 0.3.2 |
source | src |
created_at | 2021-02-10 18:51:26.707742 |
updated_at | 2023-02-14 19:07:22.9638 |
description | A global allocator implementation for embedded systems using the umm_malloc library. |
homepage | |
repository | https://github.com/mattico/umm-malloc-rs |
max_upload_size | |
id | 353341 |
size | 15,518 |
Provides a global allocator using the umm_malloc library.
umm_malloc
is a small and simple memory allocator designed for embedded systems.
It is able to allocate and free quickly with limited memory fragmentation.
All allocations from this allocator are aligned by 8 bytes. Requesting a larger alignment is not implemented and will panic.
first-fit
Use the first available block for allocation, rather than search for a better fit.
init-if-uninitialized
Adds checks to every malloc function which tries to initialize the heap (using the extern symbols for heap location)
if it is not initialized.
hang-if-uninitialized
Adds checks to every malloc function which enters an infinite loop if the heap is not initialized.
enable-pie
Compiles the umm_malloc C code position independent (-fPIE
).
You'll likely want to enable it for rustc also e.g. -C relocation-model=pie
.
Concurrent access to the global allocator is Undefined Behavior. Enable one of the following cargo features to configure how access to the global allocator is controlled.
cortex-m-interrupt-critical-section
: interrupt-disabled critical section for ARM Cortex-M processors.extern-critical-section
: Uses the extern functions void _umm_critical_entry(uint32_t*)
and
void _umm_critical_exit(uint32_t*)
to implement the global allocator critical sections. You MUST supply those
functions via some other means. Note that critical sections may nest.unsafe-no-critical-section
: no critical sections around the global allocator. You MUST prevent concurrent use
of the global allcator to avoid Undefined Behavior.umm_malloc
has features for collecting metrics and detecting heap corruption,
which could be exposed conveniently with cargo features.
An implementation of memalign could be added to umm_malloc
.