paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Optimal heap limits for reducing browser memory use

减少浏览器内存使用的最优堆上限
OOPSLA 6(OOPSLA2)2022匹配度 1/10 · 论文关注浏览器运行时垃圾回收的堆上限优化,属于运行时与内存管理,与用户主攻的静态分析、LLM/Agent、浮点程序分析及贝叶斯程序分析均无直接关联,仅有宽泛的 PL/系统边缘相关性。引用 5 inbox
Marisa Kirisame, Pranav Shenoy, Pavel Panchekha
crossref: 2026-09-10

AI 速览

一句话:提出无需通信即可在多堆间最优分配内存的平方根堆上限规则,并在 V8 中显著降低内存或 GC 时间。

垃圾回收语言运行时通过调节堆上限来权衡内存占用与 GC 时间:上限越低越省内存,但 GC 时间越高。传统方法包括手工调参和按存活对象倍数设置的经验规则,却难以比较何者更优。本文提出一个将多个堆的堆上限同时设置的框架,关键洞察是每条堆上限规则都对应一种跨进程内存分配,而该分配可能次优。基于此,作者推导出最优“平方根”堆上限规则,能在给定总 GC 时间下最小化总内存使用;该规则无需堆间通信即可实现多堆协调。作者在 V8 中实现原型,真实网页上内存降低约 16.0% 且 GC 时间不变;内存密集基准上 GC 时间最多降低 30.0% 且总内存不变。

问题
如何在多个垃圾回收堆之间设置堆上限,以在内存占用与 GC 时间之间取得最优权衡,并比较不同堆上限规则。
方法
把堆上限规则建模为多堆内存分配问题,推导出无需堆间通信的最优平方根堆上限规则,并在 V8 中实现原型。
评估
在真实网页和内存密集基准上测量内存占用与 GC 时间;真实网页内存降低约 16.0%,内存密集场景 GC 时间最多降低 30.0%。
原文摘要(Abstract)

Garbage-collected language runtimes carefully tune heap limits to reduce garbage collection time and memory usage. However, there's a trade-off: a lower heap limit reduces memory use but increases garbage collection time. Classic methods for setting heap limits include manually tuned heap limits and multiple-of-live-size rules of thumb, but it is not clear when one rule is better than another or how to compare them. We address this problem with a new framework where heap limits are set for multiple heaps at once. Our key insight is that every heap limit rule induces a particular allocation of memory across multiple processes, and this allocation can be sub-optimal. We use our framework to derive an optimal "square-root" heap limit rule, which minimizes total memory usage for any amount of total garbage collection time. Paradoxically, the square-root heap limit rule achieves this coordination without communication: it allocates memory optimally across multiple heaps without requiring any communication between those heaps. To demonstrate that this heap limit rule is effective, we prototype it for V8, the JavaScript runtime used in Google Chrome, Microsoft Edge, and other browsers, as well as in server-side frameworks like node.js and Deno. On real-world web pages, our prototype achieves reductions of approximately 16.0% of memory usage while keeping garbage collection time constant. On memory-intensive benchmarks, reductions of up to 30.0% of garbage collection time are possible with no change in total memory usage.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@article{paperbot1430,
  title = {Optimal heap limits for reducing browser memory use},
  author = {Marisa Kirisame and Pranav Shenoy and Pavel Panchekha},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {6},
  number = {OOPSLA2},
  year = {2022},
  doi = {10.1145/3563323}
}