Macro ckb_std::default_alloc
source · macro_rules! default_alloc { () => { ... }; ($fixed_block_heap_size:expr, $heap_size:expr, $min_block_size:expr) => { ... }; }
Expand description
Defines global allocator
§Example
// define global allocator
default_alloc!()
// Default allocator uses a mixed allocation strategy:
//
// * Fixed block heap, only allocate fixed size(64B) memory block
// * Dynamic memory heap, allocate any size memory block
//
// User can invoke macro with arguments to customize the heap size
// The default heap size arguments are:
// (fixed heap size 4KB, dynamic heap size 516KB, dynamic heap min memory block 64B)
default_alloc!(4 * 1024, 516 * 1024, 64)