3 ms·
Does anybody know if there are plans for an API for garbage collection? The WASM spec as it currently exists seems to be only useful for non-GC languages, and i
by saosebastiao 11y ago
Does anybody know if there are plans for an API for garbage collection? The WASM spec as it currently exists seems to be only useful for non-GC languages, and it would be a shame if we ended up shipping a new GC implementation for every page that we load. Perhaps something that would allow compilers to tap into the native JS GC?
- swolchok 11y agoWhat would the GC scan? What do pointers look like? At the assembly layer, you have the flexibility to not have a C runtime (and therefore no C stack), and you might be doing fun things like having tagged pointers that the GC would have to know about. In short, the WASM layer is IMO the wrong layer for GC. I think the closest-layered applicable solution is caching & pinning guarantees for common libraries, which may already be addressed by the same solutions for common JS libraries (use a common CDN & let the browser caching keep it pinned).
- icebraining 11y agoThe GC would scan whatever the program told it to scan, by using its API, like the Boehm GC library: https://en.wikipedia.org/wiki/Boehm_garbage_collector https://en.wikipedia.org/wiki/Boehm_garbage_collector I think it only makes sense, seeing as interaction with the native JS VM will be inevitable for a long time.
- Arelius 11y agoPerhaps then you should just use the Boehm GC library then.
- kevingadd 11y agoThere are long term plans for a GC rooting API that will let you interact with the JS heap and the DOM, yes.
- plaguuuuuu 11y agoCould see languages/libraries with auto pointers and stuff getting more popular.