Oxidizing OCaml with Modal Memory Management

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.

Authors

Institutions

Publication Details

Journal
Proceedings of the ACM on Programming Languages
Published
2024-08-15
DOI
https://doi.org/10.1145/3674642
Citations
10
Primary Topic
Logic, programming, and type systems
Type
article
Field-Weighted Citation Impact
3.47

Funders

Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Oxidizing OCaml with Modal Memory Management

Anton Lorenzen, Leo White, Sam Lindley, Richard A. Eisenberg et al.
10 citations
Proceedings of the ACM on Programming Languages
Logic, programming, and type systems
3.47
article

Oxidizing OCaml with Modal Memory Management

Anton Lorenzen, Leo White, Sam Lindley, Richard A. Eisenberg, Stephen Dolan
article en
10 citations

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.

Proceedings of the ACM on Programming LanguagesVol. 8(ICFP)
The Jane Goodall Institute (US), Jane Street (United States), University of Edinburgh (GB)
UK Research and Innovation
Openalex Percentile: Top 7%
Logic, programming, and type systems
3.47
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Oxidizing OCaml with Modal Memory Management — Anton Lorenzen, Leo White, et al. · Proceedings of the ACM on Programming Languages (2024) | TGRS Research Map | TGRS