3

I am developing a program on Solana and also testing few aspects regarding how solana enforces checks on the bpf program. However, I am stuck with the issue that I am getting the error 'memory allocation failed, out of memory' which I believe is coming because I am exhausting the 32KB heap memory available in Solana however,I am not able to find the root where this error is being thrown. I have checked the complete Solana codebase, as well as the solana rbpf cli. However, haven't found anywhere that throws the above error specifically.

Any help would be appreciated. Thanks

1
  • Nope. I was using native rust program. But Jon answer is exactly what I was looking for Commented Aug 5 at 12:44

1 Answer 1

2

The root of the error actually comes from the allocator -- when there's no more heap memory, the allocator returns a null pointer at https://github.com/anza-xyz/agave/blob/dc8dd333241ae37ff676d5743c348c9e0f13e144/sdk/program/src/entrypoint.rs#L251

And then (I think) the standard library will print the memory during a failed allocation at https://github.com/rust-lang/rust/blob/2d5a628a1de1d38318909a710ef37da6251e362e/library/alloc/src/collections/mod.rs#L136

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.