Is it possible to allocate heap memory? #191
Answered
by
thedavesims
apppppppple
asked this question in
Questions
-
#138 makes it seem like you can allocate memory, but when I try to do it in zig with const std = @import("std");
export fn update() void {
const thing = std.heap.page_allocator.alloc(u32, 1) catch @panic("alloc failed!");
std.heap.page_allocator.free(thing);
} It seems to always panic. |
Beta Was this translation helpful? Give feedback.
Answered by
thedavesims
Dec 10, 2021
Replies: 1 comment 5 replies
-
I know nothing about zig but from a quick bit of research page_allocator looks like it requests an entire page, 64k. The total memory available to wasm4 is 64k but only ~58k bytes is available for program memory so page_allocator fails. |
Beta Was this translation helpful? Give feedback.
5 replies
Answer selected by
apppppppple
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I know nothing about zig but from a quick bit of research page_allocator looks like it requests an entire page, 64k. The total memory available to wasm4 is 64k but only ~58k bytes is available for program memory so page_allocator fails.