Open jackcmay opened 3 years ago
@Lichtso The current infrastructure allows a program to create a new account with a data size up to 10k via the SystemProgram::CreateAccount
instruction. This is essentially seen as a realloc of the new account's data size. When loading all the accounts into a consecutive memory range, what did you have in mind for account allocation? We will want to put in place a mechanism that allows for both the currently allowed alloc up to 10k but also for future general re-allocations which will include both increasing and decreasing the account size up to the max account size (1GB iirc).
@jackcmay Good question. Do we know the number and size of SystemProgram::CreateAccount
before the transaction is processed? If we at least know the maximum number of accounts created, then we can leave that amount of padding in the consecutive memory range for creations and reallocations. For future bigger reallocations it might actually make sense to reserve continuous memory address space using mmap
.
Another good question, the current transaction format does not specify inner-instructions so we can't know all of the SystemProgram
instructions that might be called by a particular transaction.
I think we are close to finally fixing this issue with: https://github.com/solana-labs/solana/pull/28053
Problem
BPF program parameters (accounts, instruction data, etc...) are copy-serialized into an input buffer on program entry and back out on program exit. The overhead of copying has become significant as use cases require larger and larger accounts.
For context: https://github.com/solana-labs/solana/issues/14523
Proposed Solution