[HN Gopher] WebAssembly: How to Allocate Your Allocator
___________________________________________________________________
WebAssembly: How to Allocate Your Allocator
Author : ingve
Score : 37 points
Date : 2025-04-19 07:02 UTC (3 days ago)
(HTM) web link (nullprogram.com)
(TXT) w3m dump (nullprogram.com)
| JonChesterfield wrote:
| > (If only Clang had some sort of "noinit" variable attribute in
| order to allow heap to be uninitialized...)
|
| It's attribute((loader_uninitialized)), e.g.
| https://github.com/llvm/llvm-project/blob/main/clang/test/Se...
| kevingadd wrote:
| Though I'll note that (AFAIK) WASM environments don't expose
| access to uninitialized memory. When you grow your Memory
| object the new space is zeroed, and when you allocate it
| initially it's zeroed. This can actually show up in profilers
| when you examine application startup time.
|
| loader_uninitialized would hopefully address the zeroes in the
| module at least...
| johncolanduoni wrote:
| I wonder if the WASM runtimes still clear pages that were
| just requested from the OS. These should be already filled
| with zeroes, and at least on Linux you could even let the
| pages be lazy loaded (all WASM runtimes I know of on 64-bit
| Linux use an ~8GB virtual memory guard region, so all the
| fresh WASM pages will always be fresh OS pages as well).
___________________________________________________________________
(page generated 2025-04-22 23:01 UTC)