mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-27 12:11:12 +08:00
test: 新增内存占用基准用例与留存内存采集
bench 每轮采集在 workload 后 promote 根持有/会话引用的 epoch 对象并强制 一次 full GC,新增 peak_bytes / retained_bytes / retained_objects 三口径 (原 session_* 字段为执行期累计分配,不反映 workload 后留存);dispatch 循环增加 session 堆高水位采样,VM 暴露 session_bytes_peak 与 collect_session_gc。新增 8 个 mem_* 压力用例(对象图/字符串/闭包链/数组 增删/跨调用保留/Map/Set 保留/字符串拼接),基线扩至 76 条目。
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
// 大型对象图留存:15 层满二叉树共 32767 个节点,顶层 root 整体驻留 session 堆
|
||||
// 每节点 id 唯一(免意外共享),内节点带 left/right 子引用,叶节点带 leaf 标记
|
||||
function makeNode(depth, base) {
|
||||
if (depth === 0) {
|
||||
return { id: base, leaf: 1 };
|
||||
}
|
||||
return {
|
||||
id: base,
|
||||
depth: depth,
|
||||
left: makeNode(depth - 1, base * 2),
|
||||
right: makeNode(depth - 1, base * 2 + 1),
|
||||
};
|
||||
}
|
||||
|
||||
var root = makeNode(14, 1);
|
||||
root.left.id + root.right.right.id
|
||||
Reference in New Issue
Block a user