https://docs.soliditylang.org/en/latest/internals/layout_in_memory.html
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
Scratch space can be used between statements (i.e. within inline assembly). The zero slot is used as initial value for dynamic memory arrays and should never be written to (the free memory pointer points to `0x80` initially).
Solidity always places new objects at the free memory pointer and memory is never freed (this might change in the future).
Elements in memory arrays in Solidity always occupy multiples of 32 bytes (this is even true for `bytes1[]`, but not for `bytes` and `string`).
### Example for Difference in Arrays
The following array occupies 32 bytes (1 slot) in storage, but 128 bytes (4 items with 32 bytes each) in memory.
```solidity
uint8[4] a;
```
### Example for Difference in Struct Layout
The following struct occupies 96 bytes (3 slots of 32 bytes) in storage, but 128 bytes (4 items with 32 bytes each) in memory.
```solidity
struct S {
uint a;
uint b;
uint8 c;
uint8 d;
}
```