🔴 [H2] can_reset_vm_hwm 查询权限时会重置 VmHWM 污染内存峰值 #34
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
问题
MetricsCollector::can_reset_vm_hwm()名义上用于检查是否能重置 VmHWM,但实现直接写/proc/self/clear_refs:main.rs在 benchmark 开始前调用该函数,导致一次"权限检查"已经重置了当前进程的 VmHWM。修复
Commit:
83f633a将
fs::write替换为OpenOptions::new().write(true).open()— 仅打开文件获取 write fd,不写入数据。内核仅在 write 时重置 VmHWM,open 操作无副作用。验证:独立测试程序确认 open probe 后 VmHWM 不变(delta=0 kB),
cargo test -p log-viewer-bench16/16 通过。