You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For allocation, you're not supposed to call .vtable methods. Instead, you should call thing.allocator() which returns a struct of type std.mem.Allocator and then use .create() / .destroy() / .alloc() / .free(). This will automatically set the context parameter and provide all the default allocation functions. The context parameter is ignored for WasmAllocator but used for other allocators like the GeneralPurposeAllocator and arena allocator because they have state they need to keep for allocation that's not handled by the OS.
This github probably isn't the right place to ask zig questions. I'm not sure why the libera chat web interface is broken. The first discord mentioned here is pretty active: https://github.com/ziglang/zig/wiki/Community, and StackOverflow has people answering questions tagged zig too.
Documentation for the language is in the zig source code at doc/langref.html.in:
I've built an example of Zig+WebAssembly that goes beyond the 2+2 "hello world" in the docs, and shows how to manage memory: https://github.com/jameshfisher/zig-wasm-beyond-hello-world
But I have a few questions.
std.heap.WasmAllocator
look reasonable? I couldn't find any examples anywhere.ctx
in that API? It seems to be ignored.Note: I tried to ask the above in the recommended chat. But it just kept giving me this error "Cannot send to nick/channel":
The text was updated successfully, but these errors were encountered: