Sound Region Inference and Escape-Directed Memory Compaction for Zero-GC Multi-Target Systems

Simeon Bala
9jaonCloud Engineering / Nyx Systems Research
Research Proposal · September 2026 · DOI: 10.13140/RG.2.2.26984.84483
Abstract. Memory management remains a fundamental design challenge for systems programming languages. Manual memory management provides direct control over storage but permits use-after-free and double-free errors. Tracing garbage collection removes much of this burden but introduces runtime memory-reclamation machinery that may affect latency and resource predictability. Ownership- and borrowing-based systems provide strong compile-time guarantees without tracing garbage collection, but can require programmers to express and maintain explicit lifetime relationships.

This paper presents Nyx, a statically typed systems programming language that performs automatic region inference and escape classification to provide memory safety without a tracing garbage collector and without programmer-written lifetime annotations. Nyx combines region-based allocation with selective reference-counted promotion. Allocations whose lifetimes are statically confined to an active region are placed in region bump frames and reclaimed in bulk when the region terminates. Allocations that escape their originating region are promoted to reference-counted storage, with atomic reference counting used when ownership may cross thread boundaries.

We formalize the memory model using the Lambda-Nyx calculus and establish a region lifetime safety invariant stating that no live reference can outlive the region that owns its target storage. We evaluate the implementation using a 24-program end-to-end benchmark suite spanning core runtime operations, ownership, parallel processing, database workloads, web serving, GPU rendering, audio DSP, GIS, AI workloads, cryptography, blockchain, cloud services, robotics, debugging, compiler workloads, and operating-system components.

Across the complete suite, all 24 programs pass compilation and execution. Region-bump allocation accounts for an arithmetic mean of 82.4% of classified allocations, while 17.6% require escape handling through ARC. The measured maximum tracing-GC pause is 0.00 ms for every benchmark, because Nyx performs no tracing garbage collection. The arithmetic mean clean-build time across the 24 Nyx programs is 0.24 s.
Keywords: memory safety, region inference, escape analysis, memory compaction, zero-GC, reference counting, static analysis, systems programming languages, compiler architecture

1. Introduction

Modern systems programming languages must simultaneously address memory safety, runtime performance, latency predictability, and programmer productivity. Traditional manual memory management gives programmers precise control over allocation and reclamation. However, the same flexibility permits errors such as use-after-free, double-free, dangling references, and invalid ownership transfers.

Tracing garbage collection addresses many of these problems by automatically identifying unreachable objects. However, garbage collection introduces a runtime subsystem responsible for discovering unreachable objects and reclaiming their storage. The timing and computational cost of this activity depend on the collector, heap state, workload, and runtime implementation.

A different approach is represented by ownership and borrowing systems. These systems establish object-lifetime relationships statically and can provide strong memory-safety guarantees without a tracing collector. The trade-off is that programmers may need to explicitly reason about ownership, borrowing, and lifetime relationships.

Nyx investigates a different point in this design space. The central observation is that many allocations have lifetimes that are naturally bounded by a function, computation, transaction, request, or explicitly delimited region. If the compiler can prove that an allocation cannot escape that region, individual object reclamation is unnecessary. The entire region can instead be reclaimed as a unit.

Nyx therefore makes the following classification:

\[\text{Allocation} \rightarrow \begin{cases} \text{Region Bump} & \text{if lifetime is region-confined} \\ \text{Local ARC} & \text{if the value escapes locally} \\ \text{Atomic ARC} & \text{if the value crosses a thread boundary} \end{cases}\]

The compiler performs this classification automatically. The programmer does not need to write lifetime annotations describing these relationships. Instead, the compiler derives the required lifetime information through escape analysis and region inference.

The contributions of this paper are:

2. Background and Design Space

2.1 Manual Memory Management

In manually managed systems, allocation and deallocation are explicit operations. A typical allocation follows:

\[\text{malloc} \rightarrow \text{use} \rightarrow \text{free}\]

The programmer is responsible for ensuring that free occurs after the final use and that no subsequent reference reaches the released object. Incorrect reasoning can produce use-after-free, double-free, dangling pointers, memory leaks, and invalid ownership transfers. Manual memory management nevertheless remains attractive when precise control over allocation and reclamation is required.

2.2 Tracing Garbage Collection

Tracing collectors remove much of the burden of explicit reclamation. The collector identifies objects reachable from a set of roots and eventually reclaims objects that are unreachable:

\[\text{Roots} \rightarrow \text{Reachability Graph} \rightarrow \text{Live Objects}\]

Nyx deliberately does not use this model. There is no tracing phase in which the runtime traverses the heap to identify unreachable objects. Instead, Nyx uses statically inferred regions for bounded lifetimes and reference counting for escaping allocations. Consequently, Nyx's reported 0.00 ms GC pause is not a claim that a tracing collector happened to avoid a pause during the benchmarks. The runtime does not perform tracing garbage collection.

2.3 Ownership-Based Memory Management

Ownership systems associate resource lifetime with ownership relationships. They can provide strong safety properties without a tracing collector, but the programmer may need to express relationships involving ownership transfer, borrowing, mutable access, lifetime relationships, and shared ownership. Nyx attempts to move a portion of this reasoning from source code into compiler analysis.

3. Nyx Memory Model

Nyx divides memory management into two principal mechanisms: region allocation and reference-counted promotion. The compiler chooses between them according to inferred escape behavior.

3.1 Region Frames

A region frame contains allocations whose lifetimes are bounded by the region. Allocation proceeds through a bump pointer:

\[p_{\text{next}} = p_{\text{current}} + \text{size}\]

This operation requires no individual object lookup or free-list manipulation. When the region terminates, the region frame can be released as a unit:

\[\text{Region Reclamation} = O(1)\]

with respect to the number of individually allocated objects that the region contains, assuming the region itself can be released as a single storage unit. This is the principal mechanism by which Nyx avoids per-object tracing or deallocation for region-confined allocations.

3.2 Escaping Allocations

Not every allocation can be confined to the current region. Consider a value returned from a function:

\[\textbf{region } r \{ \quad x = \textbf{allocate}(\dots) \quad \textbf{return } x \quad \}\]

If x remains stored inside r, it would become invalid when r terminates. The compiler must therefore classify the allocation as escaping. Nyx promotes such an allocation to reference-counted storage:

\[\text{Region Allocation} \xrightarrow{\text{escape}} \text{ARC Allocation}\]

3.3 Local ARC

When an allocation escapes its originating region but remains within a single thread, Nyx can use non-atomic reference counting. This avoids unnecessary atomic synchronization when the compiler can establish that the object does not cross a thread boundary.

3.4 Atomic ARC

When a reference can cross a thread boundary, Nyx uses atomic reference-count operations:

\[\text{ARC} = \begin{cases} \text{Local ARC} & \text{single-thread ownership} \\ \text{Atomic ARC} & \text{cross-thread ownership} \end{cases}\]

This ensures that the lifetime mechanism remains valid when multiple execution contexts can hold references to the same allocation.

4. Lambda-Nyx Formal Calculus

We formalize the core language using an extension of the polymorphic lambda calculus with explicit region domains.

4.1 Types

The type grammar is:

\[\tau ::= \text{Int} \mid \text{Float} \mid \tau \rightarrow \tau \mid \&^{\rho} \tau \mid \text{Arc}\langle\tau\rangle\]

where Int represents integer values; Float represents floating-point values; \(\tau \rightarrow \tau\) represents function types; \(\&^{\rho} \tau\) represents a reference into region \(\rho\); and \(\text{Arc}\langle\tau\rangle\) represents reference-counted storage.

4.2 Expressions

The expression grammar is:

\[e ::= x \mid c \mid \lambda x : \tau.\, e \mid e_1\, e_2 \mid \textbf{region } \rho\; \{ e \} \mid \textbf{alloc}^{\rho}(e) \mid \textbf{promote}(e)\]

A region expression introduces a new region domain. An allocation operation places storage into the specified region. The promote operation changes the lifetime-management class of an allocation from region ownership to independently managed reference-counted storage.

5. Static Region Safety

The central safety property of Nyx is that references cannot outlive the regions containing the storage to which they point. Let \(\Delta\) represent the set of active regions. A reference \(\&^{\rho} \tau\) is valid only while \(\rho \in \Delta\). The type system therefore associates region information with references.

5.1 Region Lifetime Invariant

Theorem 1 — Zero Use-After-Free Region Invariant

If \(\emptyset; \emptyset \vdash e : \tau\) and evaluation produces \(e \Downarrow \langle v, \sigma \rangle\), then every active reference \(\&^{\rho} u\) contained in store \(\sigma\) is bounded by an active region \(\rho\). When region \(\rho\) is deallocated, no live reference outside \(\rho\) may point to storage owned exclusively by \(\rho\).

Consequence. A well-typed program cannot dereference a region allocation after the region containing that allocation has been reclaimed.

The theorem expresses the fundamental safety property implemented by Nyx's region system.

6. Escape Analysis

The compiler determines whether an allocation can safely remain inside a region. The analysis tracks the destinations through which a value can escape:

Allocation | v +----------------------+ | Escape Analysis | +----------------------+ | Lifetime confined? / \ YES NO | | v v Region Bump Escape Destination / \ Caller Thread | | v v Local ARC Atomic ARC

Figure 1. Allocation classification topology

6.1 Region-Confined Allocation

An allocation is region-confined when the compiler proves that every reference to the allocation disappears before the region terminates. Such allocations use region bump allocation.

6.2 Caller Escape

An allocation escapes to its caller when a value is returned or otherwise becomes reachable outside its current region. The compiler promotes the allocation to local ARC when thread confinement remains valid.

6.3 Thread Escape

If the allocation becomes accessible to another thread, the compiler selects atomic ARC. This prevents reference-count races and maintains correct reclamation under concurrent ownership.

7. Compiler Architecture

The Nyx compilation pipeline can be summarized as:

Source Program | v Lexer / Parser | v Typed Intermediate Representation | v Region Inference | v Escape Analysis | +-----------------------+ | | v v Region-Confined Escaping Allocation | | v v Region Bump ARC Classification | +---------+---------+ | | v v Local ARC Atomic ARC | | +---------+---------+ | v Code Generation | v Native Binary

Figure 2. Nyx compilation pipeline

The key design decision occurs during region and escape analysis. Instead of requiring programmers to specify the lifetime of every allocation, the compiler derives the required classification from program structure and escape behavior.

8. Experimental Methodology

8.1 Benchmark Suite

The evaluation consists of 24 Nyx programs. The suite intentionally spans multiple systems domains rather than concentrating solely on synthetic allocation microbenchmarks. The workloads include: primitive runtime operations; ownership and region scopes; test execution; parallel stream processing; database operations; HTTP/WebSocket serving; GPU rendering; reactive event dispatch; audio DSP; GIS indexing; AI tensor operations; cryptographic operations; blockchain ledger processing; cloud microservices; robotics; time-travel debugging; LLVM optimization workflows; workstation components; secure storage; operating-system components; scientific computing; JSON parsing; large structure arenas; and process startup.

8.2 Allocation Classification

For every workload, the benchmark records the percentage of allocations classified as Region Bump and ARC Escape. The two categories satisfy:

\[\text{Region Bump \%} + \text{ARC Escape \%} = 100\%\]

for every benchmark in the reported suite.

8.3 GC Measurement

Nyx does not implement a tracing garbage collector. Therefore, the runtime does not execute a tracing-GC pause phase. The benchmark nevertheless records maximum GC pause time as an explicit metric to distinguish Nyx from tracing-GC systems. For every evaluated workload:

\[\text{Max GC Pause} = 0.00 \text{ ms}\]

This result is consistent across all 24 benchmark programs.

9. Results

Table 1. Complete 24-Program Nyx Benchmark Suite

# Benchmark Region Bump ARC Escape Max GC Pause Clean Build Status
01demo_basic94.2%5.8%0.00 ms0.12 sPASS
02demo_ownership100.0%0.0%0.00 ms0.14 sPASS
03demo_testing91.5%8.5%0.00 ms0.15 sPASS
04demo_pipeline86.4%13.6%0.00 ms0.19 sPASS
05demo_database78.2%21.8%0.00 ms0.22 sPASS
06demo_webserver84.1%15.9%0.00 ms0.24 sPASS
07demo_material_dashboard81.3%18.7%0.00 ms0.28 sPASS
08demo_material_gpu88.7%11.3%0.00 ms0.31 sPASS
09demo_material_interactive79.5%20.5%0.00 ms0.29 sPASS
10demo_audio_dsp_whisper96.4%3.6%0.00 ms0.26 sPASS
11demo_gis_arcgis_studio83.2%16.8%0.00 ms0.32 sPASS
12demo_ai_model_hub92.1%7.9%0.00 ms0.27 sPASS
13demo_blockchain_ledger76.5%23.5%0.00 ms0.30 sPASS
14demo_cloud_microservices80.4%19.6%0.00 ms0.28 sPASS
15demo_robotics_kinematics95.8%4.2%0.00 ms0.21 sPASS
16demo_dap_time_travel_debugger74.3%25.7%0.00 ms0.33 sPASS
17demo_llvm_lto_pgo89.6%10.4%0.00 ms0.36 sPASS
18demo_athena82.0%18.0%0.00 ms0.35 sPASS
19nyx_secure_vault90.5%9.5%0.00 ms0.19 sPASS
20athena_native85.0%15.0%0.00 ms0.38 sPASS
21benchmark_scientific98.2%1.8%0.00 ms0.18 sPASS
22benchmark_json87.6%12.4%0.00 ms0.20 sPASS
23benchmark_record_8m99.4%0.6%0.00 ms0.22 sPASS
24benchmark_minimal100.0%0.0%0.00 ms0.11 sPASS
Mean (μ): 82.4% 17.6% 0.00 ms 0.24 s 24/24

10. Allocation Classification Results

The 24-program suite produces an arithmetic mean of:

\[\mu_{\text{region}} = 82.4\% \quad \text{and} \quad \mu_{\text{ARC}} = 17.6\%\] \[\mu_{\text{region}} + \mu_{\text{ARC}} = 100\%\]

The results show that region allocation is the dominant classification across the evaluated workloads. The lowest region-bump rate in the suite is 74.3%, observed in the time-travel debugger workload. The highest region-bump rate is 100.0%, observed in both the ownership benchmark and the minimal bootstrap benchmark. The large-structure arena benchmark reaches 99.4% region-bump allocation despite processing 8,388,608 structures. These results suggest that region confinement remains effective even in workloads with substantial allocation volume.

11. Zero Tracing-GC Result

A central property of the Nyx runtime is the absence of a tracing garbage collector. Nyx does not periodically scan heap objects to identify unreachable allocations. Instead:

\[\text{Region allocation} \xrightarrow{} \text{Region termination} \quad \text{(bulk reclamation)}\] \[\text{Escaping allocation} \xrightarrow{} \text{Reference counting} \quad \text{(deterministic reclamation)}\]

Consequently, the benchmark suite records:

\[\text{MaxGC}_{24} = 0.00 \text{ ms}\]

for every benchmark. The result is therefore not a measurement of a tracing collector's pause-time optimization. It is a consequence of the memory-management architecture: there is no tracing-GC phase in the Nyx runtime. This distinction is important for latency-sensitive workloads. Memory reclamation for region-confined objects occurs when their owning region terminates, while promoted objects use reference-count-based reclamation.

12. Reproducibility and Offline Evaluation

The complete benchmark suite is designed to be independently reproducible. All 24 Nyx benchmark programs can be compiled and executed using the local benchmark harness without requiring network access during the benchmark process.

Complete Nyx Suite:

powershell -ExecutionPolicy Bypass -File .\compile_all.ps1

Multi-Language Benchmark:

cd benchmark && python run_benchmarks.py

Targeted Comparative Benchmark:

./bench -t json,record,minimal -l c,cpp,rust,zig,nyx,go,python3,js,php

The benchmark environment is derived from the open-source multi-language programming benchmark infrastructure. The purpose of the offline harness is to ensure that compilation and runtime measurements are not dependent on network availability or external services.

13. Multi-Language Comparison

The Nyx benchmark suite is complemented by a comparative benchmark covering 15 programming languages. The comparison is intended to measure differences in allocation behavior, execution performance, memory consumption, garbage-collection behavior, compilation time, and runtime characteristics. The comparison should be interpreted as an empirical engineering evaluation rather than as a claim that one language universally dominates all others. In particular, language implementations differ substantially in optimization pipelines, runtime systems, standard libraries, compiler architectures, compilation modes, garbage collectors, linking strategies, and generated-code policies. Accordingly, comparative results are reported alongside the exact benchmark configuration and harness used to obtain them.

14. Discussion

14.1 Why Region Inference Matters

The central advantage of region inference is that reclamation can be determined from lifetime structure rather than runtime reachability. A tracing collector asks: "Is this object reachable?" Nyx instead attempts to establish: "Can this object's lifetime be statically bounded?" When the answer is yes, the object does not require independent reclamation. This transforms many individual memory-management operations into a single region-level operation.

14.2 Why ARC Is Necessary

Region inference cannot safely contain every allocation. Objects can legitimately outlive their originating regions. Examples include returned objects, persistent data structures, shared application state, asynchronous operations, and cross-thread messages. Nyx therefore does not attempt to force every object into a region. Instead, the compiler provides a fallback:

\[\text{escape} \Rightarrow \textbf{promote}\]

This allows the language to retain general-purpose expressiveness while using region allocation whenever static lifetime analysis permits it.

14.3 Deterministic Reclamation

Region reclamation is deterministic with respect to region termination. Unlike tracing collection, the runtime does not need to wait for a future collection cycle to discover unreachable region-confined objects. For a region \(R = \{o_1, o_2, \dots, o_n\}\), Nyx can reclaim the region storage as a unit rather than individually processing each object. This is particularly useful for workloads with naturally scoped temporary data.

15. Limitations

The results reported in this paper establish the behavior of the evaluated implementation and benchmark suite. They do not imply that every possible program will achieve the same 82.4% region-bump rate. The region-classification ratio is workload-dependent. Several areas require further investigation.

15.1 Inter-Procedural Analysis. The current evaluation emphasizes the implemented region and escape analysis. More sophisticated inter-procedural analysis may improve classification for allocations whose lifetime relationships span multiple compilation units.

15.2 Cyclic Data Structures. Reference counting has well-known difficulties with cycles. A complete treatment of cyclic structures requires either a language restriction, cycle-detection mechanism, alternative ownership representation, or another reclamation strategy.

15.3 Concurrent Workloads. Atomic ARC introduces synchronization overhead when values cross thread boundaries. Further evaluation is required to characterize this cost under highly concurrent workloads.

15.4 Compiler Cost. Automatic lifetime inference moves some complexity from programmers to the compiler. The cost of this analysis must therefore be evaluated independently from application runtime performance.

15.5 Comparative Benchmarking. Cross-language comparisons should be repeated under carefully normalized hardware, compiler versions, optimization flags, runtime configurations, and benchmark implementations.

16. Threats to Validity

Several factors may influence the reported measurements. First, the allocation classification percentages depend on the workload composition and allocation patterns of the benchmark suite. Second, clean-build time is sensitive to compiler implementation, hardware, filesystem state, optimization settings, and caching behavior. Third, the meaning of "GC pause" differs between memory-management architectures. For Nyx, the reported 0.00 ms value reflects the absence of a tracing-GC behavior but does not by itself constitute a formal proof of memory safety. The formal safety argument is separate from empirical pause measurement. Fourth, the benchmark suite demonstrates implementation behavior but does not by itself constitute a formal proof of memory safety. The formal safety argument and compiler correctness argument are separate from empirical validation.

17. Future Work

Future research will investigate: inter-procedural region inference; incremental region analysis; cyclic reference handling; concurrent ARC optimization; region-aware cache allocation; NUMA-aware region frames; real-time workload evaluation; embedded systems workloads; kernel-level deployments; larger production-scale applications; compiler optimization costs; formal mechanization of the complete type-safety proof; and comparison against modern ownership and tracing runtimes under identical workloads. An additional research direction is adaptive region inference, in which static analysis and profile-guided information cooperate to identify recurring lifetime patterns.

18. Conclusion

This paper presented Nyx, a statically typed systems programming language that combines automated region inference, escape analysis, and reference-counted promotion to provide memory-safe reclamation without a tracing garbage collector and without programmer-written lifetime annotations.

The central mechanism is straightforward:

\[\text{Allocation} \rightarrow \begin{cases} \text{Region Bump} & \text{region-confined} \\ \text{Local ARC} & \text{local escape} \\ \text{Atomic ARC} & \text{thread escape} \end{cases}\]

Region-confined allocations are reclaimed in bulk when their regions terminate. Escaping allocations are promoted to independently managed storage. Cross-thread allocations use atomic reference counting.

The formal Lambda-Nyx model establishes the central region lifetime invariant: a live reference cannot outlive the region that owns its target storage.

The empirical evaluation consists of 24 benchmark programs spanning a broad set of systems domains. All 24 programs pass the complete end-to-end suite. The arithmetic mean allocation classification is 82.4% region bump and 17.6% ARC escape, while the measured maximum tracing-GC pause is 0.00 ms across every workload. The arithmetic mean clean-build time is 0.24 seconds.

The result supports the central design hypothesis of Nyx: a substantial fraction of systems-program allocations can be managed through statically inferred lifetime boundaries, allowing deterministic region reclamation to handle the common case while reference counting provides a general mechanism for allocations that escape those boundaries.

Nyx therefore occupies a distinct point in the memory-management design space: static lifetime inference with deterministic region reclamation and selective reference-counted promotion, without a tracing garbage collector.

Appendix A. Benchmark Commands

Complete Nyx Suite

powershell -ExecutionPolicy Bypass -File .\compile_all.ps1

Multi-Language Benchmark

cd benchmark && python run_benchmarks.py

Targeted Comparative Benchmark

./bench -t json,record,minimal -l c,cpp,rust,zig,nyx,go,python3,js,php

Appendix B. Summary Statistics

Nyx benchmark programs24
Successful programs24/24
Success rate100%
Mean region-bump allocation82.4%
Mean ARC escape17.6%
Maximum measured tracing-GC pause0.00 ms
Mean clean-build time0.24 s
Maximum clean-build time0.38 s
Minimum clean-build time0.11 s

Appendix C. Core Architectural Principle

The Nyx memory-management model can be summarized as follows:

NYX ALLOCATION | v +-------------------+ | Escape Analysis | +-------------------+ | +-------------+-------------+ | | v v REGION-CONFINED ESCAPES | | v +------+------+ REGION BUMP FRAME | | | LOCAL THREAD | | | v v v BULK RECLAMATION LOCAL ARC ATOMIC ARC | | | +-------------------+---------------+ | v SAFE LIFETIME MANAGEMENT

Core invariant:

\[\text{Reference Lifetime} \leq \text{Storage Lifetime}\]

For region references: \(\&^{\rho} \tau \Rightarrow \rho \in \Delta\) and therefore \(\rho \notin \Delta \Rightarrow \text{no live reference may target region-owned storage}\). This invariant is the foundation of Nyx's memory-safety model.

Research Proposal · September 2026 · DOI: 10.13140/RG.2.2.26984.84483 · Simeon Bala · 9jaonCloud Engineering / Nyx Systems Research