Repository navigation
Conversation
… chaining process.memoryUsage() costs about 0.6 us in Bun, so the every-64-defs counter saves nothing measurable; globalThis.Bun?.gc keeps non-Bun hosts working. -20 tokens: merged onto main d71f42e, comp.ts is 63,994.
I pushed a commit on top of this PR with the same policy in fewer tokens:
Checks on macOS: I also didn't look further into what makes the emitter produce so much garbage. That would be the fix at the root. |
|
Thanks; I checked the current The actual public Chromi Eco workload (Chromi 70555a40, with the dependency revisions recorded in the original qualification) still compiles successfully. The emitted C is 13,320,678 bytes and byte-identical to the prior PR-head artifact: The observed peak RSS was 3,683,340 KiB and elapsed time 32.27 s. Those are standalone observations, not a claimed timing/memory improvement: there is no fresh controlled timing baseline, and the original private Darwin input is still unavailable. I did not investigate a broader emitter-allocation redesign, launch the graphical Eco application, or claim the private macOS memory report fixed. |
|
AI-written review (Claude, for @nicolas-abril). Pushed 10444e7 on top of 5342ce1. It drops the README note, which still said "every 64 definitions" and was wrong after 5342ce1. It also drops the code comment and calls Measured on a 16 GB M-series Mac. This is the machine class from #1262. I used the Chromi Eco example with the sibling repos at their Oct 10 commits. Every run gave byte-identical C, with sha256
The machine was loaded (load average ~22), so wall times aren't meaningful. Gates on 10444e7 (macOS): repo 54/54, ping 47/47, test 1600/1600, perf 124/124. Not run: Linux, CUDA. Before merge: merged onto current main, Scope: this mitigates #1262 but doesn't fix its root cause. It works around Bun sizing its heap from physical RAM. It does nothing about how much short-lived garbage emission makes, or about |
Fixes the default-GC emission pressure reported in #1262. This addresses suggestion 1 (collect transient emission garbage), not the independent incremental-emission design in open #1386. I rechecked open PRs referencing #1262 before submitting; #1386 is the only existing one.
Change
Sample Bun heap use every 64 emitted definitions. Once it exceeds 2 GiB, collect; set the next checkpoint to the post-collection live heap plus 2 GiB. This avoids using physical host RAM as the transient-garbage budget and avoids repeatedly collecting large live books that cannot be reclaimed. No re-exec, global JSC environment override, scheduling rewrite, or per-definition full GC.
The guarded checkpoint leaves non-Bun compilation unchanged. README states the resource policy and explicitly says live state is not capped. No GUIDE or CHANGELOG edit; no protected checker/kernel/gate/allow-list/cap changes.
Actual before/after
Same public Chromi Eco entry, same dependency revisions and Linux x64 host (31 GiB RAM), same Bun executable. BUN_JSC_forceRAMSize was unset. The unchanged source compiler is main 2343aec; the treatment differs only by this checkpoint and its documentation.
All three generated C files are byte-identical, checked with cmp; SHA-256: 1170f0ac04a8116080efadd8394bc896eaf5cc05a6f373ad2bbbaa2be4ba0f34.
Repository shape/cap gate: 54/54. No nondeterministic memory assertion added to the permanent test suite.
Limits: the issue's private 27k-line Darwin application was unavailable; this is a real public large application, not a reproduction claim for that exact input. No Darwin/GPU run. This is a heap-growth collection policy, not a hard RSS limit and not a solution to intrinsically oversized live compiler state.