Spegion: Implicit and Non-Lexical Regions with Sized Allocations

๐Ÿ“… 2025-06-02
๐Ÿ“ˆ Citations: 0
โœจ Influential: 0
๐Ÿ“„ PDF
๐Ÿค– AI Summary
Existing region-based memory management systems either rely on lexical scoping with explicit annotations or require a substructural type system to ensure safety for non-lexical regions, thus struggling to balance simplicity and safety. This paper introduces Spegion, a novel language featuring the first implicit non-lexical region management mechanism. It combines a splittable region model with size-aware memory allocation to achieve static memory safetyโ€”without subtyping constraints or explicit region annotations. Its effect-based type system enables fine-grained heap memory control; we formalize its small-step operational semantics and rigorously prove type soundness. By transcending the expressiveness limitations of traditional stack- or region-based memory management, Spegion establishes a new paradigm for secure, efficient, and low-overhead dynamic memory management.

Technology Category

Application Category

๐Ÿ“ Abstract
Region based memory management is a powerful tool designed with the goal of ensuring memory safety statically. The region calculus of Tofte and Talpin is a well known example of a region based system, which uses regions to manage memory in a stack-like fashion. However, the region calculus is lexically scoped and requires explicit annotation of memory regions, which can be cumbersome for the programmer. Other systems have addressed non-lexical regions, but these approaches typically require the use of a substructural type system to track the lifetimes of regions. We present Spegion, a language with implicit non-lexical regions, which provides these same memory safety guarantees for programs that go beyond using memory allocation in a stack-like manner. We are able to achieve this with a concise syntax, and without the use of substructural types, relying instead on an effect system to enforce constraints on region allocation and deallocation. These regions may be divided into sub-regions, i.e., Splittable rEgions, allowing fine grained control over memory allocation. Furthermore, Spegion permits sized allocations, where each value has an associated size which is used to ensure that regions are not over-allocated into. We present a type system for Spegion and prove it is type safe with respect to a small-step operational semantics.
Problem

Research questions and friction points this paper is trying to address.

Ensuring memory safety without lexical scoping
Managing implicit non-lexical regions without substructural types
Enabling fine-grained memory control via splittable sized regions
Innovation

Methods, ideas, or system contributions that make the work stand out.

Implicit non-lexical regions for memory safety
Effect system enforces region allocation constraints
Splittable regions enable fine-grained memory control
๐Ÿ”Ž Similar Papers
No similar papers found.
J
Jack Hughes
School of Computing, University of Kent, United Kingdom
Michael Vollmer
Michael Vollmer
University of Kent
programming languages
Mark Batty
Mark Batty
University of Cambridge