pub struct MemoryUsage {Show 24 fields
pub malloc_count: i64,
pub malloc_size: i64,
pub memory_used_count: i64,
pub memory_used_size: i64,
pub malloc_limit: i64,
pub str_count: i64,
pub str_size: i64,
pub obj_count: i64,
pub obj_size: i64,
pub prop_count: i64,
pub prop_size: i64,
pub shape_count: i64,
pub shape_size: i64,
pub js_func_count: i64,
pub js_func_size: i64,
pub js_func_code_size: i64,
pub js_func_pc2line_count: i64,
pub js_func_pc2line_size: i64,
pub c_func_count: i64,
pub array_count: i64,
pub fast_array_count: i64,
pub fast_array_elements: i64,
pub binary_object_count: i64,
pub binary_object_size: i64,
}Expand description
What one runtime occupies, in the reference’s JSMemoryUsage field names.
The names are the C header’s on purpose: quickjs-capi copies this into a
JSMemoryUsage field for field, and a C program reading s->prop_count has to get the
number this measured.
Fields§
§malloc_count: i64Live heap blocks.
malloc_size: i64Bytes those blocks hold: headers plus payloads.
memory_used_count: i64The reference’s memory used count. Equal to MemoryUsage::malloc_count, and
filled only so a C host reading the field gets an answer: the row is not printed,
because the reference’s version is this number minus an allocator overhead this
engine cannot see, and two rows with the same value under two names is noise.
memory_used_size: i64The reference’s memory used bytes. See MemoryUsage::memory_used_count.
malloc_limit: i64--memory-limit, or -1 when unlimited.
-1 rather than 0 because 0 is a legitimate limit meaning “no memory at all” — the
reference’s field is a size_t initialised to -1 for exactly this reason (see
docs/m15-plan.md’s note that JS_SetMemoryLimit(rt, 0) is not “cancel the limit”).
Reinterpreting 0 as “unlimited” in the renderer would make the one limit that refuses
every allocation print as no limit at all.
str_count: i64Strings.
str_size: i64Their bytes.
obj_count: i64Objects.
obj_size: i64Their bytes.
prop_count: i64Own properties, over all objects.
prop_size: i64Their slot bytes.
shape_count: i64Hidden classes. Always 0: see the module docs.
shape_size: i64Their bytes. Always 0.
js_func_count: i64Functions compiled from JavaScript.
js_func_size: i64Their allocations.
js_func_code_size: i64Instruction bytes.
js_func_pc2line_count: i64Functions carrying a pc-to-line table.
js_func_pc2line_size: i64Bytes of those tables.
c_func_count: i64Builtin and host functions.
array_count: i64Array objects.
fast_array_count: i64Arrays whose elements are a dense vector.
fast_array_elements: i64Elements in those.
binary_object_count: i64ArrayBuffer, TypedArray, DataView.
binary_object_size: i64Their bytes.