← Back to release summary

WebAssembly Garbage Collection (WasmGC)

Category
WebAssembly
Type
New or changed feature
Status
Enabled by default (Chrome 119)
Intent stage
Origin Trial

Summary

The GC proposal adds efficient support for high-level managed languages to WebAssembly, via struct and array types that enable language compilers targeting Wasm to integrate with a garbage collector in the host VM. In Chrome, enabling this feature implies enabling Typed Function References, which allow function references to be stored in the aforementioned structs and arrays.

Motivation

Managed languages do not fit the model of "linear" Wasm with memories residing in one ArrayBuffer. In order to enable such functionality, they need to ship their own runtime which has several drawbacks: (1) it substantially increases binary size of these modules and (2) it's unable to properly deal with links crossing the boundary between the module, other modules and the embedder that all implement their own GC who is not aware of the others. WasmGC aims at providing a managed heap that Wasm modules can use to store their own data models while all garbage collection is handled by the embedder.

Standards & signals

Explainers: https://github.com/WebAssembly/gc/blob/master/proposals/gc/Overview.md https://github.com/WebAssembly/function-references/blob/main/proposals/function-references/Overview.md

View on chromestatus.com