When a Solana program needs to work with a large account, deserializing its entire state with Borsh can become costly. A November 16, 2026 explanation of zero-copy state management points to the 4 KB stack, 32 KB heap and compute-unit (CU) consumption as constraints that become more significant as accounts grow.
Zero-copy takes a different approach: it reads account data through a defined memory layout rather than deserializing the whole structure. The approach described uses Rust’s repr(C) to fix field layout and bytemuck’s Pod and Zeroable traits to support safe conversion. It also calls for manual padding to satisfy alignment requirements and u8 flags where valid bit patterns matter.
For access through AccountLoader, load and load_mut lazily map the account data. Their Ref and RefMut values still require care with borrowing: a mutable borrow cannot overlap with another active borrow.
For accounts larger than the cited 10 KB cross-program invocation (CPI) initialization limit, the explanation describes a two-step setup in which the client first allocates the account space, then the program initializes the state. This is an account-management technique, not a claim that every large state layout is automatically safe or efficient.