diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-12-05 17:20:06 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-12-06 12:27:28 -0700 |
| commit | 823d1e70876d79dfae9dde0496e7cf293995c44a (patch) | |
| tree | e39e625d4e934b87d8b48770eff9dd5d720d0617 /lib/std | |
| parent | 4a701490d4c403938e093c6bfb32b8723eb01786 (diff) | |
| download | zig-823d1e70876d79dfae9dde0496e7cf293995c44a.tar.gz zig-823d1e70876d79dfae9dde0496e7cf293995c44a.zip | |
add std.heap.wasm_allocator
Diffstat (limited to 'lib/std')
| -rw-r--r-- | lib/std/heap.zig | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/std/heap.zig b/lib/std/heap.zig index ac77db7a79..ee6525659e 100644 --- a/lib/std/heap.zig +++ b/lib/std/heap.zig @@ -224,6 +224,16 @@ else .vtable = &PageAllocator.vtable, }; +/// This allocator is fast, small, and specific to WebAssembly. In the future, +/// this will be the implementation automatically selected by +/// `GeneralPurposeAllocator` when compiling in `ReleaseSmall` mode for wasm32 +/// and wasm64 architectures. +/// Until then, it is available here to play with. +pub const wasm_allocator = Allocator{ + .ptr = undefined, + .vtable = &std.heap.WasmAllocator.vtable, +}; + /// Verifies that the adjusted length will still map to the full length pub fn alignPageAllocLen(full_len: usize, len: usize) usize { const aligned_len = mem.alignAllocLen(full_len, len); |
