> For the complete documentation index, see [llms.txt](https://zenofchain.gitbook.io/fuel-shou-ce-the-fuel-book/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://zenofchain.gitbook.io/fuel-shou-ce-the-fuel-book/4.-fuel-xu-ni-ji-the-fuelvm/4.2-nei-cun-mo-shi-memory-mode.md).

# 4.2内存模式 (Memory Mode)

The EVM uses a linear memory (i.e. starting at zero and growing), without a defined limit. Allocating memory costs [a quadratic amount of gas](https://github.com/ethereum/yellowpaper/blob/8fea825c80e27fa9df5d89fb3365d1067788724e/Paper.tex#L2114), which severely limits the amount of memory usable in a single context (i.e. contract call).

EVM使用线性内存（即从零开始增长），没有一个定义的限制。分配内存需要花费[二次方的gas量](https://github.com/ethereum/yellowpaper/blob/8fea825c80e27fa9df5d89fb3365d1067788724e/Paper.tex#L2114)，这严重限制了单个环境（即合约调用）中可用的内存量。

In addition, the EVM has a separate memory space per context. Contexts may communicate with each other by copying data to call data and returning data buffers.

此外，EVM的每个环境都有一个独立的内存空间。环境可以通过将数据复制到调用数据和返回数据缓冲区来相互通信。

The FuelVM uses a single share memory block *per transaction*. Memory is allocated statically with a known upper bound, allowing for straightforward implementation of heap types such as [vectors](https://github.com/FuelLabs/sway/blob/master/sway-lib-std/src/vec.sw). Memory in the FuelVM is globally readable across contexts, but locally writable. Each context may only write to portions of the stack and the heap which it has [ownership](https://fuellabs.github.io/fuel-specs/master/vm/index#ownership) over.

FuelVM在每笔交易中使用一个单一的共享 *内存块* 内存是静态分配的，有一个已知的上限，允许直接实现堆的类型，如[向量](https://github.com/FuelLabs/sway/blob/master/sway-lib-std/src/vec.sw)。FuelVM中的内存在整个环境中是只读的，但在本地是可修改的的。每个环境只能修改部分堆栈和其[所有权](https://fuellabs.github.io/fuel-specs/master/vm/index#ownership)对应的堆。
