How do bindings with GC languages work?

I was looking at wasm-bindgen and neon. I noticed that wasm-bindgen will make a method on exported structs called free that drops the struct and frees its memory, but it looks like neon doesn't. Is neon able to hook into the node GC and have the GC drop and free the struct? Will the wasm GC proposal allow for wasm-bindgen to do the same thing?

The weakref proposal is afaik what is supposed to do similar cleanup outside of node.

The way it works in rlua is that each Rust reference to a Lua object is considered a root by the GC, and elements can be GC'd when they are no longer accessible through any root.

So the weakref proposal will allow hooking into the GC for javascript. What about other wasm targets? Is there a proposal that will handle this in a general way in wasm?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.