10000 tsdb: zero out Labels and memSeries pointers in pool (#13712) · rnadupal/prometheus@bbe39af · GitHub
[go: up one dir, main page]

Skip to content

Commit bbe39af

Browse files
bborehambeorn7
andauthored
tsdb: zero out Labels and memSeries pointers in pool (prometheus#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>
1 parent 0eb39a6 commit bbe39af

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tsdb/head_append.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,9 @@ func (h *Head) putExemplarBuffer(b []exemplarWithSeriesRef) {
229229
if b == nil {
230230
return
231231
}
232+
for i := range b { // Zero out to avoid retaining label data.
233+
b[i].exemplar.Labels = labels.EmptyLabels()
234+
}
232235

233236
h.exemplarsPool.Put(b[:0])
234237
}
@@ -278,6 +281,9 @@ func (h *Head) getSeriesBuffer() []*memSeries {
278281
}
279282

280283
func (h *Head) putSeriesBuffer(b []*memSeries) {
284+
for i := range b { // Zero out to avoid retaining data.
285+
b[i] = nil
286+
}
281287
h.seriesPool.Put(b[:0])
282288
}
283289

0 commit comments

Comments
 (0)
0