diff --git a/lib/mergeset/inmemory_part.go b/lib/mergeset/inmemory_part.go index 6b4db2a464..9b41faca82 100644 --- a/lib/mergeset/inmemory_part.go +++ b/lib/mergeset/inmemory_part.go @@ -1,8 +1,6 @@ package mergeset import ( - "sync" - "github.com/VictoriaMetrics/VictoriaMetrics/lib/bytesutil" "github.com/VictoriaMetrics/VictoriaMetrics/lib/encoding" "github.com/VictoriaMetrics/VictoriaMetrics/lib/logger" @@ -90,18 +88,3 @@ func (mp *inmemoryPart) NewPart() *part { func (mp *inmemoryPart) size() uint64 { return uint64(len(mp.metaindexData.B) + len(mp.indexData.B) + len(mp.itemsData.B) + len(mp.lensData.B)) } - -func getInmemoryPart() *inmemoryPart { - v := inmemoryPartPool.Get() - if v == nil { - return &inmemoryPart{} - } - return v.(*inmemoryPart) -} - -func putInmemoryPart(mp *inmemoryPart) { - mp.Reset() - inmemoryPartPool.Put(mp) -} - -var inmemoryPartPool sync.Pool diff --git a/lib/mergeset/table.go b/lib/mergeset/table.go index b9e9f8c5b8..29448de6c8 100644 --- a/lib/mergeset/table.go +++ b/lib/mergeset/table.go @@ -738,7 +738,7 @@ func (tb *Table) mergeInmemoryBlocks(ibs []*inmemoryBlock) *partWrapper { } if len(bsrs) == 1 { // Nothing to merge. Just return a single inmemory part. - mp := getInmemoryPart() + mp := &inmemoryPart{} mp.Init(&bsrs[0].Block) p := mp.NewPart() return &partWrapper{ @@ -750,9 +750,6 @@ func (tb *Table) mergeInmemoryBlocks(ibs []*inmemoryBlock) *partWrapper { // Prepare blockStreamWriter for destination part. bsw := getBlockStreamWriter() - // Do not obtain mpDst via getInmemoryPart(), since its size - // may be too big comparing to other entries in the pool. - // This may result in increased memory usage because of high fragmentation. mpDst := &inmemoryPart{} bsw.InitFromInmemoryPart(mpDst)