---
title: "A new way to bring garbage collected programming languages efficiently to WebAssembly · V8"
description: "Garbage-collected languages like Java, Kotlin, Dart, Python and C# can reach WebAssembly in two ways: compile an existing language VM to linear-memory WasmMVP, or lower the language's objects onto WasmGC structs and arrays managed by the host VM's garbage collector."
url: "https://swe.quest/articles/a-new-way-to-bring-garbage-collected-programming-languages-efficiently-to-667c409700cf29b4"
canonical: "https://v8.dev/blog/wasm-gc-porting"
source: "V8"
published: "2023-11-01"
difficulty: "hard"
kind: "Deep dive"
reading_minutes: 20
tags: ["webassembly","memory-management","runtimes","compilers"]
---

# A new way to bring garbage collected programming languages efficiently to WebAssembly · V8

A post on [V8](https://swe.quest/sources/v8.md), published 2023-11-01, 20 min read, Deep dive. Original: [https://v8.dev/blog/wasm-gc-porting](https://v8.dev/blog/wasm-gc-porting)

## Summary

Garbage-collected languages like Java, Kotlin, Dart, Python and C# can reach WebAssembly in two ways: compile an existing language VM to linear-memory WasmMVP, or lower the language's objects onto WasmGC structs and arrays managed by the host VM's garbage collector. WasmGC produces smaller binaries because no GC or malloc is shipped, collects cycles between JS and Wasm at fine granularity, sees stack references without shadow stacks, and avoids linear-memory fragmentation. It also reuses the browser's generational and incremental GC and integrates with DevTools heap profiling. The costs are substantial new toolchain work and possible compromises in language semantics, since struct fields have fixed indexes and types and there are no interior pointers, whereas a traditional port preserves exact semantics with little effort. Later sections cover V8 and toolchain optimizations for WasmGC, with benchmark numbers.

Written by swe.quest, not by the author.

**Difficulty:** Hard: written for specialists in the field

## Topics

- [WebAssembly](https://swe.quest/tags/webassembly.md) (Languages)
- [Memory management](https://swe.quest/tags/memory-management.md) (Compilers & runtimes)
- [Runtimes & VMs](https://swe.quest/tags/runtimes.md) (Compilers & runtimes)
- [Compilers](https://swe.quest/tags/compilers.md) (Compilers & runtimes)

## Prerequisites

- WebAssembly basics ([easy posts on WebAssembly](https://swe.quest/tags/webassembly.md?difficulty=easy))
- garbage collection concepts ([easy posts on Memory management](https://swe.quest/tags/memory-management.md?difficulty=easy))
- language VM architecture ([easy posts on Virtualization](https://swe.quest/tags/virtualization.md?difficulty=easy))

## Keywords

WasmGC, V8, WasmMVP, dart2wasm, J2CL, Pyodide, Blazor, Chrome DevTools

## Related posts

- [Extensible Language Support in Zed - Part 1](https://swe.quest/articles/extensible-language-support-in-zed-part-1-13bc037c6f5096a9.md): Zed · 2024-04-18 · Medium · 7 min read · WebAssembly, Developer tools, Sandboxing & isolation, Compilers, Rust
  Zed loads third-party Tree-sitter grammars as WebAssembly modules using a hybrid design.
- [Why is WebAssembly a second-class language on the web?](https://swe.quest/articles/why-is-webassembly-a-second-class-language-on-the-web-36ba94a05082ce89.md): Mozilla Hacks · 2026-02-26 · Medium · 13 min read · WebAssembly, Browsers, Language design, Performance engineering
  WebAssembly remains second-class on the web because it can only load code and reach Web APIs through JavaScript.
- [Speculative Optimizations for WebAssembly using Deopts and Inlining](https://swe.quest/articles/speculative-optimizations-for-webassembly-using-deopts-and-inlining-bb89e7c53ac7945f.md): V8 · 2025-06-24 · Hard · 17 min read · WebAssembly, Compilers, Runtimes & VMs, Performance engineering
  V8 in Chrome M137 adds speculative call\_indirect inlining and deoptimization support for WebAssembly, using runtime call-target feedback gathered by the Liftoff baseline compiler so TurboFan can inline up to four likely callees behind cheap instance and target checks.
- [Introducing the JetStream 3 Benchmark Suite](https://swe.quest/articles/introducing-the-jetstream-3-benchmark-suite-df1c85fb12e2a75d.md): WebKit · 2026-03-31 · Hard · 21 min read · Runtimes & VMs, WebAssembly, Compilers, Memory management, Performance engineering
  JetStream 3 replaces JetStream 2's separate Wasm Startup/Runtime scores with the JavaScript-style first-iteration, worst-case and average-case scoring.
- [V8 release v6.9 · V8](https://swe.quest/articles/v8-release-v6-9-v8-d0efd26e2594b2df.md): V8 · 2018-08-07 · Easy · 4 min read · Runtimes & VMs, JavaScript, Memory management, WebAssembly, Compilers
  V8 v6.9 embeds built-in functions directly into the binary on x64, so all Isolates share one copy instead of each holding up to 700 KB on its own heap.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
