You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Value stores JavaScript strings as *StringCell, but src/gc.zig currently treats every non-object value as an immediate primitive. Runtime StringCells and their byte storage are therefore arena-permanent and cannot participate in precise liveness or exact external-buffer finalization. That blocks #324 and leaves allocation-heavy string workloads outside the real heap lifecycle.
Scope
Add an explicit heap-managed StringCell kind and distinguish static/intern-table/arena cells from collectible runtime cells without pointer guessing.
Route fallible runtime string construction through the active context heap when GC is enabled, retaining the existing explicit arena mode where configured.
Trace string-valued roots and edges everywhere Value is traced, including interpreter frames, environments, object slots/elements/accessors, promises, modules, workers, C-API handles, debugger state, temporary roots, and concurrent snapshots.
Finalize owned string bytes exactly once and provide a general external-owner finalizer record usable by ABI: implement external ZigString ownership and finalization #324; callbacks must run outside collector/internal object locks and remain safe under reentry.
Integrate the required cell-kind/finalizer support into ~/Code/Libraries/zig-gc as a separately committed dependency change only if the generic collector needs extension.
Stress high-churn strings in arena and GC modes; demonstrate bounded live bytes after collections and no regressions in equality or observable string semantics.
Run leak/finalizer accounting and relevant no-GIL/TSan stress, including concurrent marking snapshots if enabled.
Parent: #134
Required by: #324
Related: #97, #144
Problem
Valuestores JavaScript strings as*StringCell, butsrc/gc.zigcurrently treats every non-object value as an immediate primitive. Runtime StringCells and their byte storage are therefore arena-permanent and cannot participate in precise liveness or exact external-buffer finalization. That blocks #324 and leaves allocation-heavy string workloads outside the real heap lifecycle.Scope
Valueis traced, including interpreter frames, environments, object slots/elements/accessors, promises, modules, workers, C-API handles, debugger state, temporary roots, and concurrent snapshots.~/Code/Libraries/zig-gcas a separately committed dependency change only if the generic collector needs extension.Acceptance