From 228e17d79bf6dbef63598f54067140ecb81c77a8 Mon Sep 17 00:00:00 2001 From: Carlo Alberto Ferraris Date: Sat, 17 Feb 2018 20:41:07 +0900 Subject: [PATCH] Do not drop on the floor small buffers Currently if a buffer from the buffer is too small to satisfy its request then we simply drop it and allocate a new one. This change puts it back in the pool and then allocates a new one. --- tsdb/engine/tsm1/pools.go | 1 + 1 file changed, 1 insertion(+) diff --git a/tsdb/engine/tsm1/pools.go b/tsdb/engine/tsm1/pools.go index 79f74be554..02d4d6231e 100644 --- a/tsdb/engine/tsm1/pools.go +++ b/tsdb/engine/tsm1/pools.go @@ -13,6 +13,7 @@ func getBuf(size int) *[]byte { } buf := x.(*[]byte) if cap(*buf) < size { + bufPool.Put(x) b := make([]byte, size) return &b }