aboutsummaryrefslogtreecommitdiffstats
path: root/docs/miscellaneous.rst
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2016-10-11 19:25:18 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2016-10-11 20:20:58 +0800
commitf0524ed45a407ff9b1b59ee04edbfb9489a4f8a1 (patch)
tree377b6466b2e4dec54a24300185ba86a965016c5f /docs/miscellaneous.rst
parentd3f410d8a89aaa042ff264d7a0ea79184e01abab (diff)
downloaddexon-solidity-f0524ed45a407ff9b1b59ee04edbfb9489a4f8a1.tar.gz
dexon-solidity-f0524ed45a407ff9b1b59ee04edbfb9489a4f8a1.tar.zst
dexon-solidity-f0524ed45a407ff9b1b59ee04edbfb9489a4f8a1.zip
Document memory layout
Diffstat (limited to 'docs/miscellaneous.rst')
-rw-r--r--docs/miscellaneous.rst14
1 files changed, 14 insertions, 0 deletions
diff --git a/docs/miscellaneous.rst b/docs/miscellaneous.rst
index c4a954ad..cdc82c78 100644
--- a/docs/miscellaneous.rst
+++ b/docs/miscellaneous.rst
@@ -56,6 +56,20 @@ So for the following contract snippet::
The position of ``data[4][9].b`` is at ``keccak256(uint256(9) . keccak256(uint256(4) . uint256(1))) + 1``.
+****************
+Layout in Memory
+****************
+
+EVM memory is linear. Reading is limited to 256-bit width, but both 8-bit and 256-bit writes are allowed. Memory size is 0 at the beginning of execution. Memory is expanded by accessing (either reading or writing) a previously untouched memory offset. At the time of expansion, the cost in gas must be paid.
+
+Solidity reserves three 256-bit slots:
+- 0 - 64: scratch space for hashing methods
+- 64 - 96: currently allocated memory size (aka. free memory pointer)
+
+Solidity always places new objects at the free memory pointer and memory is never freed.
+
+.. index: memory layout
+
*****************
Esoteric Features
*****************