Repository navigation
Add opt-in incremental GC with automatic pacing - #380
Merged
Merged
Conversation
Large live heaps currently require one uninterrupted major mark. Retain mark queues between stopped-world slices, record mutations with the existing generated barriers, and resume array and map scans through managed owners. Keep the current collector as the default. Add library scheduling hooks, independent reachability verification, epoch recovery, allocator range preservation, conventional regressions and CI stress coverage. Record matched frame and allocation benchmarks. Tail latency improves on the measured workloads, but throughput and finishing-pause gates remain open in #372. Concurrent marking in #327 stays deferred.
This was referenced Oct 27, 2026
The installation fixture copied extraParams.hxml without its new macro dependency, so compiler probes failed with Type not found before reading the version defines. Include the actual macro and archive nested fixture files. Reproduced the missing type in the Linux installation check. All installation, setup, update and off checks pass on Windows and Linux after the fixture correction.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Major collections currently trace the live heap in one stop. This adds an experimental
HXCPP_GC_INCREMENTALmode that retains marking progress across shorter stops and advances automatically through allocation slow paths. The existing collector remains the default.The mode uses Haxe 4.3's existing generated setter barriers without a compiler or standard library patch. It adds mutation logs, resumable array and map scans, library-owned scheduling hooks, an independent reachability verifier and synchronous recovery. Native bulk mutations retain their owners, detached threads transfer pending entries, and partial collections preserve allocator ranges. Recovery rewinds the partial epoch before a full mark so the alternating-bit fast path cannot mistake unvisited objects for survivors.
Enable with
-lib hxcpp -D HXCPP_GC_INCREMENTALand regenerate C++. Optional hooks are inhxcpp.gc.Incremental. Emscripten, cppia, nursery, moving and unsupported Haxe API layouts are rejected. Weak processing, finalizers, root capture, rendezvous, reclamation and forced completion can exceed the slice target.Validation:
Matched Windows x64 measurements use three processes, two warmups and five measured samples per process, with verification disabled and identical checksums:
gc_framesgc_pausesThe largest per-process frame p99.9 fell from 7.742 ms to 0.969 ms. The throughput target is still unmet, and cumulative explicit collections still exceed 2 ms. This remains a draft pending CI, broader integration coverage and the performance gates in #372. The protocol, source hashes and raw samples are in
bench/results/incremental-gc; API and mutation details are indocs/IncrementalGc.md.Refs #372. Concurrent marking in #327 remains deferred.