Add note about memory arrays to 'Layout in Memory' section

Copied from the Inlien Assembly part
This commit is contained in:
Mathias Baumann 2019-12-11 16:53:18 +01:00
parent 7247e72d8b
commit 8226869579

View File

@ -371,6 +371,12 @@ is used as initial value for dynamic memory arrays and should never be written t
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 ``byte[]``, but not for ``bytes`` and ``string``).
Multi-dimensional memory arrays are pointers to memory arrays. The length of a
dynamic array is stored at the first slot of the array and followed by the array
elements.
.. warning::
There are some operations in Solidity that need a temporary memory area larger than 64 bytes and therefore will not fit into the scratch space. They will be placed where the free memory points to, but given their short lifetime, the pointer is not updated. The memory may or may not be zeroed out. Because of this, one shouldn't expect the free memory to point to zeroed out memory.