Closed posix4e closed 5 years ago
The heap gets reset to empty just above the line you quoted:
I faked a malloc() implementation for this demo because I didn't want to figure out how to build a real one. It's a bump allocator, and the bump pointer gets reset to the start of the arena on every request. It's probably not the best approach for real apps.
I regret filing the issue and thank you for your time following up. Your commenting there is already fine. After we forked this, those comments got lost
@posix4e No problem! FWIW I'd highly recommend investigating tooling like emscripten, wasm-pack, etc. instead of copying what I did here. Or if you can use Rust instead of C/C++, that's even better, as Wrangler (our CLI) has direct support for it.
Thanks for the feedback!
https://github.com/cloudflare/cloudflare-workers-wasm-demo/blob/6d7067d90e1d44910af4afe69d33fccdd1aa5609/main.c#L34
I'm confused if this gets freed every request