Guide · updated November 2026
WasmGC: garbage collection comes to WebAssembly.
WebAssembly GC lets languages like Kotlin, Dart, Java and OCaml compile to the web without shipping their own garbage collector. Builds get smaller, start faster and share memory management with the browser. Here's what it is, where it runs, and why game developers should care.
- Live feature check
- Language support
- Size impact
- Game notes
What is WasmGC?
WasmGC is a WebAssembly extension that adds garbage-collected structs and arrays managed by the browser's own collector. Languages with garbage collection (Kotlin, Dart, Java, OCaml, Scheme) can compile to compact Wasm instead of bundling a collector. It shipped in Chrome 119, Firefox 120 and Safari 18.2, so all major browsers support it.
Why WebAssembly needed GC
WebAssembly started with one flat block of linear memory, perfect for C, C++ and Rust, which manage memory themselves. Languages with garbage collection had two bad options: compile to JavaScript, or compile their whole runtime, collector included, into Wasm. That added megabytes, and the two collectors (yours and the browser's) couldn't see each other's objects, which caused leaks across the JavaScript boundary.
WasmGC adds typed structs and arrays that live on the browser's managed heap. The engine's collector traces them like JavaScript objects, so there's one collector, no runtime to ship and no cross-boundary leaks.
Languages that compile to WasmGC
| Language | Toolchain | Status |
|---|---|---|
| Kotlin | Kotlin/Wasm (Compose Multiplatform for web) | Beta, actively used |
| Dart / Flutter | dart2wasm, Flutter web | Stable, default for Flutter web's Wasm build |
| Java | J2Wasm (Google), TeaVM | Used in production by Google apps |
| OCaml | wasm_of_ocaml | Working |
| Scheme | Hoot (Guile) | Working |
| C# / .NET | Blazor WebAssembly | Still ships its own runtime; WasmGC exploration ongoing |
| C, C++, Rust | Emscripten, wasm-bindgen | Don't need GC; use linear memory |
Browser support
| Browser | Version | Year |
|---|---|---|
| Chrome / Edge | 119 | 2023 |
| Firefox | 120 | 2023 |
| Safari | 18.2 | 2024 |
What it means for web games
Most web game engines today are JavaScript (Phaser, three.js) or C++/Rust compiled to linear-memory Wasm (Godot, Unity, Bevy), so WasmGC doesn't change them directly. Where it matters is games written in GC languages: Kotlin and Dart game frameworks, Java-based engines such as libGDX via TeaVM, and future C# paths. Their web builds become much smaller and start faster.
For every game, the bigger Wasm wins in practice are SIMD (faster maths), threads (parallel physics and decoding) and smaller downloads. Check what your players have with the feature test above, and see our WebGL and WebGPU test for the graphics side.
Detecting WasmGC support
// A tiny module that declares a GC struct type. If it validates, WasmGC is supported.
const gcProbe = new Uint8Array([
0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, // magic + version
0x01, 0x05, 0x01, 0x5f, 0x01, 0x7f, 0x00, // type section: struct { i32 }
]);
export const hasWasmGC = WebAssembly.validate(gcProbe);Frequently asked questions
Is WasmGC supported in all browsers?
Yes, since Safari 18.2 in December 2024 all three major engines (Chromium, Firefox, Safari) support it.
Does Rust or C++ use WasmGC?
No, they manage memory themselves and use WebAssembly's linear memory. WasmGC is for languages that rely on garbage collection.
Does WasmGC make code faster?
Mostly smaller and quicker to start, since no collector is shipped. Runtime speed depends on the language and compiler; Google reported large improvements moving some apps to WasmGC.
Can I use WasmGC from JavaScript?
Yes, GC objects can be passed to JavaScript as opaque references and back. Direct field access from JS is limited.
EvonX AI game maker
Got the asset? Now make the game.
Describe your game in one sentence and EvonX builds it: code, art, sound and a link you can share. Free to start, no download, plays on any phone.