-
Notifications
You must be signed in to change notification settings - Fork 14
Description
Description
While researching the Garbage Collector Redesign for GSoC 2026, I have been investigating the reconciliation of our custom collection traits with the standard Rust Allocator API.
The Problem
The current allocation paths in the experimental lab, specifically in src/alloc/arena/mod.rs, rely on an exclusive &mut self signature. This creates a fundamental architectural mismatch with the standard Rust Allocator trait, which requires a shared &self reference to allow for concurrent or shared allocation requests.
The Evidence (Precedent in Boa)
We already have an established pattern for solving this within the core engine. In the boa_mempool crate (specifically around line 129), the implementation utilizes RefCell<Vec<Chunk<T>>> to wrap underlying memory pools. This allows the public MemPoolAllocator to expose a thread-safe (or at least runtime-checked) &self API while still performing the necessary mutations on the underlying chunks.
Proposed Research: The "Trace" Bridge
To address the safety concerns raised in Issue #11—specifically regarding Vec<T, GcAllocator> not automatically keeping its backing allocation alive—I am researching a GcBox<T> or Handle<T> wrapper.
The goal is to ensure that:
- The wrapper implements the
Tracetrait. - During a GC sweep, the collector can reach the backing memory even if the outer collection is not GC-aware.