Skip to main content

no_allocator

Macro no_allocator 

Source
macro_rules! no_allocator {
    () => { ... };
}
Expand description

Set up a no-op global allocator that aborts on allocation.

Useful for no_std programs that must not allocate. Any attempt to allocate immediately aborts the invocation through the SVM’s abort syscall. No experimental inline assembly is required. Returning null would also be valid for GlobalAlloc; this allocator deliberately fails immediately.