I tried to make a transaction using solana/web3.js ComputeBudgetProgram.requestHeap

I tried a multiple of the default amount, 4 * 32 * 1024 to no avail, program still fails where it did without. I heard I need a custom allocator, is there an example of using one?


1 Answer 1


To request heap frame, you need to declare custom-heap feature. Without this feature, solana defines global allocator where it assumes 32kb of heap. Once you declare custom-heap feature, you can either define your own allocator using #[allocator] macro or use the default allocator which doesnt assume 32kb of heap and gets the heap amount from the VM configuration shown below.

https://github.com/solana-labs/solana/blob/a2d2eb3ba80824f55c9cbd267ab881a285ca324a/programs/bpf_loader/src/lib.rs#L256 .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.