In sp-core
it is defined the maximum memory that can be allocated by the runtime. The current max possible allocation is 32 MiB:
// substrate/primitives/core/src/lib.rs (snip)
/// The maximum number of bytes that can be allocated at one time.
// The maximum possible allocation size was chosen rather arbitrary, 32 MiB should be enough for
// everybody.
pub const MAX_POSSIBLE_ALLOCATION: u32 = 33554432; // 2^25 bytes, 32 MiB
Although the comments state that the 32MiB limit is arbitrary, I wonder if there is any reason to limit the WASM allocation memory so much given that the limit imposed by WASM is 4GiB?
As a follow-up question, is there anything preventing us from increasing this value further if needed?