Skip to content
Preprint

Memory Allocation for Constant-Bounded Programs

Aug 2026 · 0 citations · 36 references
Computer Science

TL;DR

This work shows 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, and guarantees memory usage bounded by the maximum live memory plus, at most, the size of the largest buffer.

Abstract

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.

View source

Similar papers

#machine learning Preprint Oct 2026

Exact Memory-Time Optimization for Prefix-Cached Language Model Serving

Retaining language-model prefix states trades recomputation against storage time. Optimizing each cached block independently can overcount savings: a resident block is usable only when the required preceding prefix is also available. We introduce Prefix-Certificate Retention (PCR), an exact finite-trace formulation for...

Shivam Gupta · 0 citations
Preprint Aug 2026

LazyTrain: Limited-resource Allocation toward Zero-waste Yield Optimization in Large Language Model Training

LazyTrain is proposed, an optimization layer over a layer-streaming executor that formulates checkpoint selection, activation placement, recomputation, and CPU-GPU-NVMe communication overlap as a mixed-integer scheduling problem, then executes the solved policy during training.

Xiao-Jun Wu, Ce-Hao Yang, Hong-Hao Liu et al. · 1 citation
Book Open access Sep 2026

Quantifying the Code-Size Overhead of eBPF JIT Compilation

eBPF allows user-defined programs to safely extend Linux kernel functionality at runtime, but its final machine code comes from a compilation pipeline that differs from native targets, and how efficient that pipeline is has no clear reference point. Our work constructs one: using the standard LLVM x86 backend as an app...

Hoang Duong, Hao Sun, Zhen-Dong Su · 0 citations
Open access Sep 2026

MemPrint: Constructing Program Memory Footprint Estimations using Statistical Methods from Sparsely Sampled Pin-based Memory Traces

Knowing the precise memory footprint of applications is necessary to optimize their memory behavior via compiler passes. However, obtaining the memory footprint of workloads is challenging. Tracking heap allocations using Valgrind’s Massif tool provides insufficient information, as stack usage and allocations made by o...

Nafis Mustakin, Joseph Manzano, Daniel Wong · 1 citation
Aug 2026

PMDangNull: Preventing use-After-Free for Persistent Memory Applications

Use-After-Free (UAF) remains one of the most critical security threats affecting C/C++ programs. Moreover, the cross-restart persistence semantics of persistent memory (PM) programming models significantly broaden the UAF attack surface. Existing DRAM-based protection schemes lack crash consistency guarantees, whereas...

Yuquan Chi, Yinjin Fu, Yong-Gang Hu et al. · 0 citations
Book Open access Aug 2026

Don't Stall Me Now: Hiding Memory Latency in eBPF

Beeswax overlaps the execution of program stages, and thus hides cache miss overheads, and is applied to Katran, a load balancer deployed in production data centers, and BMC, a key-value store accelerator.

Farbod Shahinfar, Marco Molè, Aurojit Panda et al. · 0 citations

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.