[论文解读] An Extended Low Fat Allocator API and Applications
本文提出了一种扩展的 LowFat 分配器 API,利用低脂指针——在原生指针中编码对象大小和基地址——实现高效、低延迟的操作,如大小、基地址和偏移量的检索。其主要贡献在于在堆、栈和全局对象上统一支持这些扩展操作,从而实现新型应用,如内存错误检测、紧凑数据结构和类型化指针,且性能开销极小。
The primary function of memory allocators is to allocate and deallocate chunks of memory primarily through the malloc API. Many memory allocators also implement other API extensions, such as deriving the size of an allocated object from the object's pointer, or calculating the base address of an allocation from an interior pointer. In this paper, we propose a general purpose extended allocator API built around these common extensions. We argue that such extended APIs have many applications and demonstrate several use cases, such as (manual) memory error detection, meta data storage, typed pointers and compact data-structures. Because most existing allocators were not designed for the extended API, traditional implementations are expensive or not possible. Recently, the LowFat allocator for heap and stack objects has been developed. The LowFat allocator is an implementation of the idea of low-fat pointers, where object bounds information (size and base) are encoded into the native machine pointer representation itself. The "killer app" for low-fat pointers is automated bounds check instrumentation for program hardening and bug detection. However, the LowFat allocator can also be used to implement highly optimized version of the extended allocator API, which makes the new applications (listed above) possible. In this paper, we implement and evaluate several applications based efficient memory allocator API extensions using low-fat pointers. We also extend the LowFat allocator to cover global objects for the first time.
研究动机与目标
- 解决传统 malloc API 缺乏标准化、高效的扩展机制以检索分配元数据(如大小、基地址和偏移量)的问题。
- 通过一致的扩展 API 实现对内存对象(堆、栈和全局)的统一处理。
- 证明低脂指针编码可实现高度优化的内联操作,对性能敏感的应用至关重要。
- 支持以往因传统分配器开销过高而不可行的新编程模式和数据结构。
- 将 LowFat 分配器扩展至支持全局对象,完整覆盖 C/C++ 程序中所有主要对象类型。
提出的方法
- 利用 64 位指针对齐和未使用位,通过位域将对象大小和基地址直接编码到指针表示中。
- 使用编译为少数内联汇编指令的低脂指针操作实现扩展 API,最大限度降低运行时开销。
- 通过在查找表中存储元数据,将 LowFat 分配器扩展以支持全局变量,从而在所有对象类型间实现一致行为。
- 使用扩展 API 实现边界检查、隐藏元数据存储、类型化指针和紧凑向量等应用。
- 通过微基准测试评估性能,涵盖向量构造、访问和大小计算等操作,将 LowFat 与传统和 Boehm GC 方法进行比较。
- 利用 LowFat 操作的高效性,支持需要频繁访问元数据的应用,如加固工具中的边界检查。
实验结果
研究问题
- RQ1低脂指针编码能否扩展至全局变量,以实现在所有对象类型上的统一元数据访问?
- RQ2与传统分配器相比,使用低脂指针实现扩展分配器操作(大小、基地址、偏移量)的效率如何?
- RQ3基于扩展 LowFat API 的应用会产生多大的性能开销?在何种条件下其优势显著?
- RQ4扩展 API 是否能支持新型编程模式,如类型化指针或紧凑数据结构,这些在标准分配器下难以实现?
- RQ5与现有替代方案(如 Boehm 垃圾回收器)相比,LowFat 实现的性能表现如何,适用于类似用例?
主要发现
- 扩展的 LowFat API 仅需少数内联指令即可完成大小、基地址和偏移量操作,平均延迟低于 10 个周期。
- 低脂向量通过消除显式的 len 和 pos 字段,减少内存开销,在所有字段均为 1 字长时每向量节省 3 个字。
- 构造低脂向量的性能开销为 1.33× 至 2×,具体取决于大小对齐方式,访问开销约为 1.2×。
- 在大小类型指针基准测试中,低脂标记指针比传统标记指针快约 20%;而扩展标记指针虽慢约 27%,但支持更多标签位。
- 由于库调用开销,Boehm GC 实现的类似功能比 LowFat 慢两倍以上,凸显了内联操作的优势。
- 将低脂指针扩展至全局对象,实现了对堆、栈和全局内存的完整覆盖,使扩展 API 在 C/C++ 程序中具有普遍适用性。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。