Expand description
The memory report behind qjs -d / --dump and JS_ComputeMemoryUsage.
§Why this is a walk and not a set of counters
Tracking every number the reference tracks would mean a counter incremented at each of
the two hundred places that define a property or push an element, and one forgotten site
makes the report quietly wrong — the exact failure mode Heap::measure_used avoids for
the memory limit (see its comment). So the numbers here are measured: walk the live
boxes once, downcast, and add up. JS_ComputeMemoryUsage in the reference is also a walk
over its object lists, so this is the same design rather than a substitute for it.
§What is real and what is zero
| row | how |
|---|---|
memory allocated | the heap’s live registry; headers plus payload |
strings | every live JsString, by byte length |
objects | every live JsObject |
properties | sum of props.len() over those objects, by slot capacity |
shapes | always 0 — this engine has no hidden-class sharing |
bytecode functions, bytecode | live CompiledCode, by instruction bytes |
C functions | callables that are native or host closures |
arrays, fast arrays, elements | ObjectKind::Array and its element vector |
binary objects | ArrayBuffer, TypedArray, DataView |
atoms | not printed — property keys are ordinary strings here |
A zero that means “not modelled” is labelled as such in the rendered report, because the
one thing worse than a missing number is a wrong one that looks measured
(docs/test262-status.md §4.37).
Structs§
- Class
Census - The per-class census that the reference prints between the header and the table.
- Memory
Usage - What one runtime occupies, in the reference’s
JSMemoryUsagefield names.