Skip to main content

Questions tagged [allocate]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
3 votes
1 answer
197 views

Handling out of memory issues in heap

We have a CPI that uses ~4000 bytes of heap, and it executes a few times in a loop, so for a few executes the program will fail with memory allocation failed, out of memory. The solution has been to ...
Whiteseal's user avatar
  • 3,597
3 votes
1 answer
560 views

What is the memory usage limit on solana's programs?

What is the maximum memory that a solana program can allocate before throwing an out of memory exception, and how is it handled during the program's execution? Is this documented anywhere, like the ...
0xGhohun's user avatar
1 vote
1 answer
149 views

Is it possible to write a custom allocator at all? where do I store internal data structure?

Static writable data is not supported. I could store it in the heap itself, only if there is some way to store a flag indicating if initialization is called. Has this ever been done before? This is ...
oxfeeefeee's user avatar
1 vote
1 answer
109 views

Allocate data on memory region

I have initilized a PDA with 10000 bytes of space and a Vector on its stored data: #[derive(Accounts, Clone)] pub struct CreateVectorPda<'info> { /// CHECK: Just testing #[account(mut)] ...
user3688985's user avatar
1 vote
1 answer
142 views

How to calculate space for an account dynamically using remaining_accounts

Is it possible to allocate space to an account based on account provided in remaining_accounts? I want to allocate enough space to store public key of the accounts provided in remaining_accounts in a ...
onurhb's user avatar
  • 113
1 vote
1 answer
43 views

In solana anchor, how to use max_len macro to define multi-dimensional vector?

I'm using anchor to build solana program. In account struct, I have multi-dimensional vector. #[max_len(2,50)] element: Vec<Vec<MyType>>, In this case, what is the meaning of (2, 50)? I ...
toygr's user avatar
  • 190