MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / initMemory

Function initMemory

src/runtime_init_memory.js:14–31  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12// check for full engine support (use string 'subarray' to avoid closure compiler confusion)
13
14function initMemory() {
15#if WASM_ESM_INTEGRATION && PTHREADS
16 if (ENVIRONMENT_IS_PTHREAD) {
17 wasmMemory = globalThis.wasmMemory;
18 assert(wasmMemory);
19 updateMemoryViews();
20 }
21#endif
22
23 {{{ runIfWorkerThread('return') }}}
24
25#if expectToReceiveOnModule('wasmMemory')
26 if (Module['wasmMemory']) {
27 wasmMemory = Module['wasmMemory'];
28 } else
29#endif
30 {
31 var INITIAL_MEMORY = {{{ makeModuleReceiveExpr('INITIAL_MEMORY', INITIAL_MEMORY) }}};
32
33#if ASSERTIONS
34 assert(INITIAL_MEMORY >= {{{ STACK_SIZE }}}, `INITIAL_MEMORY should be larger than STACK_SIZE, was ${INITIAL_MEMORY}! (STACK_SIZE={{{ STACK_SIZE }}})`);

Callers 2

postlibrary.jsFile · 0.85

Calls 4

runIfWorkerThreadFunction · 0.85
assertFunction · 0.70
updateMemoryViewsFunction · 0.70
expectToReceiveOnModuleFunction · 0.50

Tested by

no test coverage detected