mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 03:31:05 +00:00
Companion: Limit the maximum number of wasm memory pages a runtime can have (#3449)
* Add `max_memory_pages` * update Substrate Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com> Co-authored-by: parity-processbot <>
This commit is contained in:
Generated
+154
-154
File diff suppressed because it is too large
Load Diff
@@ -26,8 +26,24 @@ use sp_wasm_interface::HostFunctions as _;
|
|||||||
use std::any::{Any, TypeId};
|
use std::any::{Any, TypeId};
|
||||||
|
|
||||||
const CONFIG: Config = Config {
|
const CONFIG: Config = Config {
|
||||||
// TODO: Make sure we don't use more than 1GB: https://github.com/paritytech/polkadot/issues/699
|
// Memory configuration
|
||||||
|
//
|
||||||
|
// When Substrate Runtime is instantiated, a number of wasm pages are mounted for the Substrate
|
||||||
|
// Runtime instance. The number of pages is specified by `heap_pages`.
|
||||||
|
//
|
||||||
|
// Besides `heap_pages` linear memory requests an initial number of pages. Those pages are
|
||||||
|
// typically used for placing the so-called shadow stack and the data section.
|
||||||
|
//
|
||||||
|
// By default, rustc (or lld specifically) allocates 1 MiB for the shadow stack. That is, 16
|
||||||
|
// wasm pages.
|
||||||
|
//
|
||||||
|
// Data section for runtimes are typically rather small and can fit in a single digit number of
|
||||||
|
// wasm pages.
|
||||||
|
//
|
||||||
|
// Thus let's assume that 32 pages or 2 MiB are used for these needs.
|
||||||
|
max_memory_pages: Some(2048 + 32),
|
||||||
heap_pages: 2048,
|
heap_pages: 2048,
|
||||||
|
|
||||||
allow_missing_func_imports: true,
|
allow_missing_func_imports: true,
|
||||||
cache_path: None,
|
cache_path: None,
|
||||||
semantics: Semantics {
|
semantics: Semantics {
|
||||||
|
|||||||
Reference in New Issue
Block a user