v149 · WebAssembly · WasmGC
Memory Footprint Demo
The key advantage of WasmGC custom descriptors is memory: the descriptor is a shared type-level object, so method references live on the prototype — not copied into every instance. This page measures and visualises the per-instance overhead of three allocation patterns as you scale from 10 to 10,000 objects.
Per-instance closures
—
estimated total (KB)
—
bytes per object
// Each instance carries own functions
this.getValue = () => …;
this.increment = () => …;
JS wrapper class
—
estimated total (KB)
—
bytes per object
// Methods on prototype; ptr per-instance
Counter.prototype.getValue = …;
Counter.prototype.increment = …;
Custom descriptor (WasmGC)
—
estimated total (KB)
—
bytes per object
// Descriptor is shared at type level
// No JS wrapper needed; only data fields
// per instance. Methods live in Wasm type.
Run the measurement to see savings.
see also
- Prototype Bridge — wrapper vs descriptor patterns
- Type-Safe Objects — type boundary enforcement
- Method Dispatch Bench — dispatch speed comparison
- JS Interop Explorer — live method calls and instanceof
implementation reference
Need the exact API surface, compatibility boundaries, errors, lifecycle, and source links? Read the matching gendn reference ↗