News for hackers. Stuff that matters.
Re:CPython's main branch running in the browser with WebAsse... by KMag on Monday November 29, 2021 @12:24AM (#29376706)
My knowledge is years out of date, but does WASM still require the application to request its maximum memory footprint up-front? Granted, that's what Sun/Oracle's JVM has been doing to allocate its heap from the OS for well over a decade, but I'm also not aware if WASM is able to use the equivalent of madvise() to tell the browser/OS that it's fine to unmap a region of memory and map it back zeroed-out when it's next needed.
Re:CPython's main branch running in the browser with WebAsse... by AkshitGarg on Monday November 29, 2021 @12:44AM (#29376809)
Yep you need to specify the maximum memory amount up-front. Its defined as "webassembly memory pages". Each page is 64kb. You need to specify an initial and a maximum amount. The webassembly module can call memory.grow() to grow it by a page until it reaches the maximum. Though you can't "un-grow" or decrease the amount of allocated memory.
Re:CPython's main branch running in the browser with WebAsse... by daniellehmann on Monday November 29, 2021 @04:46AM (#29377938)
This is not correct, it is not necessary to specify a maximum memory size. See the WebAssembly specification https://webassembly.github.io/spec/core/syntax/modules.html#.... Due to 32-bit address space, the maximum memory is limited to 4GB however.

(In asm.js, memory was provided by an ArrayBuffer of fixed size, so there memory could truly not grow at runtime.)