From 8ad523ca0837652b1efd06f6179b3c893301ac1b Mon Sep 17 00:00:00 2001 From: andy pan Date: Mon, 2 Jul 2018 14:39:31 +0800 Subject: [PATCH] defer release pool --- ants_benchmark_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ants_benchmark_test.go b/ants_benchmark_test.go index 566c794..aed0a8e 100644 --- a/ants_benchmark_test.go +++ b/ants_benchmark_test.go @@ -83,7 +83,7 @@ func BenchmarkAntsPoolWithFunc(b *testing.B) { wg.Done() return nil }) - p.Release() + defer p.Release() for i := 0; i < b.N; i++ { for j := 0; j < RunTimes; j++ { @@ -105,7 +105,7 @@ func BenchmarkGoroutine(b *testing.B) { func BenchmarkAntsPool(b *testing.B) { p, _ := ants.NewPoolWithFunc(50000, demoPoolFunc) - p.Release() + defer p.Release() b.ResetTimer() for i := 0; i < b.N; i++ {