Open
Description
How would I go about getting memory accurate readings?
When doing
(async () => {
let QJS = await QuickJS.getQuickJS();
let rt = QJS.newRuntime();
let memoryLimit = 1024 * 32; // 32 KiB
rt.setMemoryLimit(memoryLimit);
rt.setMaxStackSize(2048);
console.log(rt.computeMemoryUsage().consume(rt.getSystemContext().dump));
})().catch(console.error);
I get the result of
{
malloc_limit: 32768, // bytes limit provided
memory_used_size: 43402, // past bytes limit
malloc_count: 835,
memory_used_count: 835,
atom_count: 486,
atom_size: 16490,
str_count: 0,
str_size: 0,
obj_count: 145,
obj_size: 6960,
prop_count: 806,
prop_size: 6968,
shape_count: 52,
shape_size: 10896,
js_func_count: 0,
js_func_size: 0,
js_func_code_size: 0,
js_func_pc2line_count: 0,
js_func_pc2line_size: 0,
c_func_count: 91,
array_count: 1,
fast_array_count: 1,
fast_array_elements: 0,
binary_object_count: 0,
binary_object_size: 0
}
Not to mention the memory_used_size
, before any contexts other than the system context, scales with the allowed malloc_limit
.
Metadata
Metadata
Assignees
Labels
No labels