Abstract
Programmers can often improve the performance of their programs by reducing heap allocations: either by allocating on the stack or reusing existing memory in-place. However, without safety guarantees, these optimizations can easily lead to use-after-free errors and even type unsoundness. In this paper, we present a design based on modes which allows programmers to safely reduce allocations by using stack allocation and in-place updates of immutable structures. We focus on three mode axes: affinity, uniqueness and locality. Modes are fully backwards compatible with existing OCaml code and can be completely inferred. Our work makes manual memory management in OCaml safe and convenient and charts a path towards bringing the benefits of Rust to OCaml.
| Original language | English |
|---|---|
| Article number | 253 |
| Pages (from-to) | 485-514 |
| Number of pages | 30 |
| Journal | Proceedings of the ACM on Programming Languages |
| Volume | 8 |
| Issue number | ICFP |
| DOIs | |
| Publication status | Published - 15 Aug 2024 |
Keywords / Materials (for Non-textual outputs)
- modal types
- stack allocation
- type qualifiers
- uniqueness types
Fingerprint
Dive into the research topics of 'Oxidizing OCaml with modal memory management'. Together they form a unique fingerprint.Projects
- 1 Finished
-
Effect Handler Oriented Programming
Lindley, S. (Principal Investigator)
1/02/21 → 31/01/25
Project: Research
Cite this
- APA
- Author
- BIBTEX
- Harvard
- Standard
- RIS
- Vancouver