Skip to content

Commit

Permalink
test: fix gc test on go 1.16
Browse files Browse the repository at this point in the history
No idea why we need this, but go 1.16 doesn't always completely GC the
first round.
  • Loading branch information
Stebalien committed May 10, 2021
1 parent 4016316 commit aec6289
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ func TestPool(t *testing.T) {

debug.SetGCPercent(100) // to allow following GC to actually run
runtime.GC()
// For some reason, you need to run GC twice on go 1.16 if you want it to reliably work.
runtime.GC()
if g := p.Get(10); &g[0] == &a[0] {
t.Fatalf("got a; want new slice after GC")
}
Expand Down

0 comments on commit aec6289

Please sign in to comment.