tsdb: zero out Labels and memSeries pointers in pool (#13712)
* tsdb: zero out Labels and memSeries pointers in pool So that the garbage-collector doesn't see this memory as still in use. Signed-off-by: Bryan Boreham <bjboreham@gmail.com> --------- Signed-off-by: Bryan Boreham <bjboreham@gmail.com> Signed-off-by: Björn Rabenstein <github@rabenste.in> Co-authored-by: Björn Rabenstein <github@rabenste.in>
This commit is contained in:
parent
0eb39a604b
commit
bbe39af99f
|
@ -229,6 +229,9 @@ func (h *Head) putExemplarBuffer(b []exemplarWithSeriesRef) {
|
|||
if b == nil {
|
||||
return
|
||||
}
|
||||
for i := range b { // Zero out to avoid retaining label data.
|
||||
b[i].exemplar.Labels = labels.EmptyLabels()
|
||||
}
|
||||
|
||||
h.exemplarsPool.Put(b[:0])
|
||||
}
|
||||
|
@ -278,6 +281,9 @@ func (h *Head) getSeriesBuffer() []*memSeries {
|
|||
}
|
||||
|
||||
func (h *Head) putSeriesBuffer(b []*memSeries) {
|
||||
for i := range b { // Zero out to avoid retaining data.
|
||||
b[i] = nil
|
||||
}
|
||||
h.seriesPool.Put(b[:0])
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue