Skip to content

feat: Add --gc-frequency option to debug-build.sh#1395

Open
TartanLlama wants to merge 4 commits intomainfrom
sy/gc-zeal
Open

feat: Add --gc-frequency option to debug-build.sh#1395
TartanLlama wants to merge 4 commits intomainfrom
sy/gc-zeal

Conversation

@TartanLlama
Copy link
Copy Markdown
Contributor

The JS::SetGCZeal function runs the garbage collector at a higher frequency to help find memory bugs. This PR introduces a way to include it for debug builds:

  • CMake has a new option called -DFASTLY_GC_FREQUENCY, which sets the number of allocations between GC runs
  • The debug-build.sh script has a new --gc-frequency flag to set this
  • JS::SetGCZeal is called at startup so long as FASTLY_GC_FREQUENCY and JS_GC_ZEAL are set (the latter is set by the JS runtime in debug builds)

Currently this is just for local testing, although we could add this to CI if we wanted. The easiest way to run it is npm run build:debug -- --gc-frequency 100 (100 is a decent frequency for finding bugs)

Fixes #1204.

@TartanLlama TartanLlama requested review from zkat March 26, 2026 15:36
@TartanLlama TartanLlama changed the title Add --gc-frequency option to debug-build.sh feat: Add --gc-frequency option to debug-build.sh Mar 26, 2026
@TartanLlama TartanLlama enabled auto-merge (squash) March 26, 2026 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Testing: Run testing with a higher GC zeal

2 participants