按年被提到
20192019 · 3 次2026
编程语言与编译器›编译器与运行时优化·arXiv:1902.04738 · cs.PL

Mesh: Compacting Memory Management for C/C++ Applications

Mesh:面向 C/C++ 应用的内存压缩整理
Bobby Powers, David Tench, Emery D. Berger, Andrew McGregor · 2019

无需改源码的 malloc 替代品,用随机算法消除内存碎片

开始阅读 ↗PDFalphaXiv 讨论
被推荐 · 8 人首次 2019-02-17 · 最近 2025-01-11
8不同的人
7活跃月份
8讨论串
19被引(OpenAlex)

Mesh 是一个可直接替换 malloc 的内存分配器,用随机化算法结合虚拟内存操作,把稀疏的内存页合并,从而在不修改 C/C++ 程序的前提下消除碎片,并以高概率突破经典的 Robson 界。它的运行性能与最先进的分配器相当,同时让 Firefox 的内存占用降低 16%,Redis 降低 39%。

HN 为什么提它

HN 上的人用它说明“碎片问题在 C/C++ 里也能解决”:不改源码就能做类似垃圾回收的内存压缩,有人还考虑把它用在自己的语言运行时里。

方法难度 4 / 5约 50 分钟经得起时间
读之前最好知道
1malloc/free 与内存分配器
2内存碎片(fragmentation)
3虚拟内存与页映射
4随机化算法(randomized algorithms)

HN 书评

推荐在前,同类按时间 · 每篇最多保留 20 条,统计用全部提及
推荐superjan · 2025-01

“There’s a great paper from the group of Emery Berger, where they merge memory pages that become sparse.”

推荐 Emery Berger 组的论文,合并变稀疏的内存页
Using black magic to make a fast circular buffer (2017)原评论 ↗
引用sanxiyn · 2019-05

“Fragmentation is solvable. Mesh can compact C programs using malloc/free without any source changes.”

称碎片可解决,Mesh 无需改源码即可压缩 C 程序堆
For Better Computing, Liberate CPUs from Garbage Collection原评论 ↗
引用vanderZwan · 2019-05

“crazy enough nobody bothered to publish it until February this year!”

感叹 shuffle vector 这个技巧到今年二月才有人发表
A new core playlist for VLC 4原评论 ↗
引用moonchild · 2021-05

“Actually...Mesh”

贴出 Mesh 论文作为回应,它是减少 C/C++ 内存碎片的分配器
The compiler will optimize that away原评论 ↗
引用verdagon · 2023-07

“We planned to use something like MESH [0] to reduce the fragmentation.”

提到 Vale 曾计划用类似 Mesh 的方法减少碎片
Vale's First Prototype for Immutable Region Borrowing原评论 ↗
被提交为 story · 3 次