arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2608.14471cs.PL

有界常量程序的内存分配

Memory Allocation for Constant-Bounded Programs

Vinícius Silva, Kael Soares, Márcio Costa e Fernando Magno Quintão Pereira

中文总结 AI 辅助

本研究针对有界常量程序,提出结合内存碎片整理的树扫描分配策略,在Elixir转eBPF编译器及有界MLIR程序中部署后,栈空间减少超90%,内存使用量远优于朴素分配策略。

中文摘要 AI 辅助

本研究针对所有输入的执行长度在语法上受限制的有界常量程序,探究其内存分配问题。这类程序的示例包括经验证的内核扩展、密码学例程以及固定形状的机器学习模型。研究表明,有界常量性可通过将控制流视为树并应用结合内存碎片整理的树扫描分配策略,实现最优栈使用的紧密多项式时间近似。该方法保证内存使用量不超过最大活跃内存加上至多最大缓冲区的大小,且在允许就地交换时是最优的。研究人员在两种场景中部署了所提出的分配器:一是在Elixir转eBPF编译器中作为优化栈空间的spiller;二是作为使用结构化控制流方言的有界MLIR程序的静态堆分配器。结果显示,在真实eBPF工作负载上栈减少超过90%,且即使在激进的代码扩展下,碎片整理也很少需要,内存使用量仍仅为朴素分配策略所需的一小部分。

英文摘要

This work studies memory allocation for constant-bounded programs, whose execution length is syntactically limited for all inputs. Examples of such programs include verified kernel extensions, cryptographic routines, and fixed-shape machine-learning models. We show that constant boundedness enables a tight, polynomial-time approximation of optimal stack usage by viewing control flow as a tree and applying a tree-scan allocation strategy augmented with memory defragmentation. Our approach guarantees memory usage bounded by the maximum live memory plus, at most, the size of the largest buffer, and is optimal when in-place swapping is permitted. We deploy the proposed allocator in two scenarios. First, in an Elixir-to-eBPF compiler, as a spiller that optimizes stack space. Second, as a static heap allocator for bounded MLIR programs using the Structured Control-Flow dialect. Results demonstrate stack reductions exceeding 90% on real eBPF workloads and show that, even under aggressive code expansion, defragmentation is rarely required and memory usage remains a small fraction of that required by naive allocation strategies.

补充信息

↑