From aec6289162185640ab9c10621008469590f8d9f7 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Mon, 10 May 2021 12:32:04 -0700 Subject: [PATCH] test: fix gc test on go 1.16 No idea why we need this, but go 1.16 doesn't always completely GC the first round. --- pool_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pool_test.go b/pool_test.go index 7421bd5..4b5ff7a 100644 --- a/pool_test.go +++ b/pool_test.go @@ -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") } -- GitLab