Graph of memory locations in Solidity: storage, calldata, etc…

Julien Klepatch

In Solidity smart contracts, there are 4 memory locations:

  • storage
  • memory
  • stack
  • calldata

They all have different lifetimes and it’s not always easy to choose which one is right. In the below graph I drew their lifetimes against the execution of blocks, smart contract and functions.

Lifetime of memory locations in Solidity

Storage is the only memory location than span across block, i.e it persists to the blockchain.

Memory spans across multiple function executions in the same smart contract.

Stack last only as long as the function it is contained in.

And calldata is only available in the argument of the outer function execution

0 Comments

Leave a Reply

More great articles

Timelock in Solidity

A timelock is a piece of code that locks functionality on an application until a certain amount of time has…

Read Story

Terra Blockchain explained in 2 mins




Terra is a Blockchain built for ecommerce. In 2021 its price was multiplied by 70, and the value locked in…

Read Story

Web3.js explained in 2 mins

If you want to interact with a smart contract on Ethereum,



 the API of Ethereum is complicated.

 To interact with…

Read Story

Never miss a minute

Get great content to your inbox every week. No spam.
[contact-form-7 id="6" title="Footer CTA Subscribe Form"]
Arrow-up