Please let me know if you have any difficulties with the wasm memory management method.

Asked 2 years ago, Updated 2 years ago, 357 views

Thank you for your help.

I'm studying wasm based on a book called Hands-on WebAssembly, and I hear that wasm's memory management uses JavaScript's ArrayBuffer, so I can't use the malloc function of the standard C library.

The fact that memory management can only use linear memory as a trade-off to strengthen security is not just a simple porting task, but I would like to know if you have any specific experience.

Thank you for your cooperation.

wasm

2022-10-31 22:21

1 Answers

In app development, C/C++ on Emscripten can be equivalent to malloc via libc implementation or run-time such as Rust or Go, so I don't remember any difficulties in memory management itself except for debugger lack of functionality and alignment limitations.I feel that the limitations of running in small pieces in the browser are greater.

When creating your own WASM-enabled compiler or interpreter, you had to prepare your own libc-equivalent features without Emscripten, access to registers and stacks, and lack of virtual memory meant you could not port to other architectures.
I've only experienced a little test implementation, and implementing a practical language processing system may cause you a lot of other difficulties.


2022-10-31 22:21

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.