Skip to content

Commit 5a6d4ee

Browse files
authored
Clarify double GC (#478)
1 parent 0ba569d commit 5a6d4ee

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

cmd/tsgo/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ func main() {
226226
totalTime := time.Since(startTime)
227227

228228
var memStats runtime.MemStats
229+
// GC must be called twice to allow things to settle.
229230
runtime.GC()
230231
runtime.GC()
231232
runtime.ReadMemStats(&memStats)

internal/binder/binder_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ func BenchmarkBind(b *testing.B) {
2929

3030
compilerOptions := &core.CompilerOptions{Target: core.ScriptTargetESNext, ModuleKind: core.ModuleKindNodeNext}
3131

32-
// The above parses do a lot of work; ensure GC is settled before we start collecting pefrormance data.
32+
// The above parses do a lot of work; ensure GC is finished before we start collecting pefrormance data.
33+
// GC must be called twice to allow things to settle.
3334
runtime.GC()
3435
runtime.GC()
3536

0 commit comments

Comments
 (0)