Repository navigation
fix(compute): use -gc=precise for TinyGo default build command (#1480) - #1917
Closed
Tyagiquamar wants to merge 1 commit into
Closed
Tyagiquamar wants to merge 1 commit into
Tyagiquamar wants to merge 1 commit into
Conversation
Member
|
Hi @Tyagiquamar - please use our PR template: |
Contributor
Author
|
Updated the PR description to match the current template, including the Core Features section, while preserving the rationale, user impact, and validation details. No code changes. |
Member
|
Thanks for your contribution @Tyagiquamar. Hard-coding |
5 tasks done
WhiteAbeLincoln
added a commit
that referenced
this pull request
Oct 2, 2026
…nd (#1926) ### Change summary For tinygo binaries before version 0.34, the default is `-gc=conservative`. version 0.34 swapped the default to precise. Dropping the gc flag completely preserves the current behavior for users on older tinygo versions, and switches to the precise collector for newer tinygo. When benchmarked within viceroy, the change generally results in a faster binary and the same memory usage, but under some workloads (that allocate lots of small pointer-heavy objects) the peak memory usage can be higher. The reason seems to be explained by [the commit message](tinygo-org/tinygo@655075e) that introduces the collector, which says “It does however use a bit more RAM to store the layout of each object”. Workloads which care about memory usage more than execution speed can revert this change by adding a build script to their `fastly.toml`: `build = "tinygo build -target=wasi -gc=conservative -o bin/main.wasm ./"` Also note that this change only affects users who do not currently have a build script in their fastly.toml file. The [current tinygo starter kit](https://github.com/fastly/compute-starter-kits/blob/5024939c7297c9705b5693193ec3cba1f2346b8b/starter-kits/go/tinygo/fastly.toml#L12) already provides a build script which is identical to this change. See PR #1917 and issue #1480. Fixes #1480 All Submissions: * [X] Have you followed the guidelines in our Contributing document? * [X] Have you checked to ensure there aren't other open [Pull Requests](https://github.com/fastly/cli/pulls) for the same update/change? <!-- You can erase any parts of this template not applicable to your Pull Request. --> ### New Feature Submissions: * [X] Does your submission pass tests? ### Changes to Core Features: * [X] Have you written new tests for your core changes, as applicable? * [X] Have you successfully run tests with your changes locally? ### User Impact Changes the collector used to `precise` for users of `tinygo>=0.34` ### Are there any considerations that need to be addressed for release? <!-- Any breaking changes, etc -->
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.
Change summary
Updates the default fallback build command for TinyGo in
pkg/commands/compute/language_go.gofrom-gc=conservativeto-gc=precise. The precise collector provides more accurate and efficient garbage collection in Wasm builds and avoids the memory corruption reported in #1480.Fixes #1480.
All Submissions:
Changes to Core Features:
User Impact
TinyGo compute builds now default to the precise garbage collector, which fixes memory corruption in Wasm output. Users who need the old behavior can still pass
-gc=conservativeexplicitly in their build command.Are there any considerations that need to be addressed for release?
None; the change only alters the default fallback build command for TinyGo.
Verification
gofmt -l pkg/commands/compute/language_go.go(clean)go test ./pkg/commands/compute/...in Dockergolang:1.26-bookworm(all tests pass)