macro_rules! custom_heap {
() => { ... };
}Expand description
On Solana, defines BumpAllocator as the global allocator.
When compiling for Solana, defines a new instance of BumpAllocator and
declares it as a the global allocator. When compiling for other platforms,
does nothing.
Note that, as always when defining custom global allocator on Solana, if
using solana_program::entrypoint or anchor::program macros, the smart
contract must define and enable custom-heap feature. Otherwise, global
allocator defined by this macro and in solana_program will clash.
§Example
ⓘ
#[cfg(not(feature = "cpi"))]
solana_allocator::custom_heap!();