Nobody is expecting every single developer to carefully write their own garbage collector. WASM is a compilation target for other languages. The language you're compiling defines how memory management works, be that C / Zig (do it yourself), Rust (compile time borrow checker), Swift/ObjC (Rc / arc) or Go/JS/Java/C# (full garbage collector built into the language).
For GCed languages like Go or C#, the design choice WASM makes is between:
1. The compiler injects its own garbage collector into the created webassembly modules, just like it does when compiling native binaries.
or 2. The webassembly virtual machine provides a garbage collector that any compiled code can use.
The benefit of (1) is that it makes webassembly virtual machines simpler and safer. (This is what the GP comment wants). (Also compilers can do language-specific optimizations to their own GC.)
But (2) has a bunch of benefits too:
- The GC can be higher performance (its not written in webassembly).
- Interoperability between WASM bundles written in different languages is much better. Eg it'd be easier for Go in a WASM bundle to talk to JS in the browser. Or Go and C# code to interoperate via WASM.
- The .wasm modules for GCed languages will be much smaller, since they don't need to compile in a garbage collector.
The Go/Java/C# you write will be the same. The difference is who provides the garbage collector. Your compiler, or the WASM virtual machine?