Module gear_core::memory

source ·
Expand description

Module for memory and allocations context.




  • A gear page size, currently 4KiB to fit the most common native page size. This is size of memory data pages in storage. So, in lazy-pages, when program tries to access some memory interval - we can download just some number of gear pages instead of whole wasm page. The number of small pages, which must be downloaded, is depends on host native page size, so can vary.
  • A WebAssembly page has a constant size of 64KiB.


  • Before and after memory grow actions.
  • Backend wasm memory interface.
  • Trait represents page with u32 size for u32 memory: max memory size is 2^32 bytes. All operations with page guarantees, that no addr or page number can be overflowed.

Type Definitions

  • Host pointer type. Host pointer can be 64bit or less, to support both we use u64.
  • Alias for inner type of page buffer.