In most solidity contracts, the first few opcodes generate the free memory pointer

PUSH1 0x80 
PUSH1 0x40 

This places the 0x80 value (128) at location 0x40 in memory. So, why don't we start the free memory pointer at 0x00? Why do we place it 0x40 down.

And additionally, why do we say that the free memory starts at 0x80 when the pointer is only 1 byte?

1 Answer 1


Per the solidity documentation

Solidity reserves four 32-byte slots, with specific byte ranges (inclusive of endpoints) being used as follows:

  • 0x00 - 0x3f (64 bytes): scratch space for hashing methods
  • 0x40 - 0x5f (32 bytes): currently allocated memory size (aka. free memory pointer)
  • 0x60 - 0x7f (32 bytes): zero slot

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.