Read-only call input and writable working memory have different roles.
LET’S PICTURE IT
A sealed incoming form differs from a writable working copy on the desk.
SEE IT FOR YOURSELF
Use temporary memory in one execution frameStep 1 / 4
This frame uses temporary byte-addressed memory. Solidity normally keeps a free memory pointer at address 0x40, initially pointing to 0x80.
This frame uses temporary byte-addressed memory. Solidity normally keeps a free memory pointer at address 0x40, initially pointing to 0x80.In this simplified example, MSTORE writes integer forty-two into thirty-two bytes beginning at memory byte 0x80. Accessing this range may expand active memory.MLOAD at byte 0x80 reads that complete thirty-two-byte word back as a stack value. It does not fetch persistent storage or network data.RETURN can expose a chosen memory range as output. Frame memory is temporary; returning data does not turn it into persistent contract state.
Animated local teaching model. No wallet, RPC or live blockchain data. Some labels and hashes are abbreviated for readability.
Identify the location in the type
A Solidity reference parameter may be in calldata or memory depending on its declaration and context. The location changes access and copying behavior.
Use calldata for suitable input reads
Calldata is read-only input for the current message call. Reading it directly can avoid constructing a full writable memory copy when the operation supports that approach.
Copy when writable data is needed
Moving a byte sequence into memory allocates working space and copies data. The destination uses memory layout, which is not simply the packed storage representation.
Measure actual operations
A calldata declaration is not a universal zero-cost promise. Hashing, external calls and other operations may still require particular memory ranges or explicit copying.