Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pkg/ingester/client/timeseries.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,11 @@ func ReuseSlice(ts []PreallocTimeseries) {

// ReuseTimeseries puts the timeseries back into a sync.Pool for reuse.
func ReuseTimeseries(ts *TimeSeries) {
// Name and Value may point into a large gRPC buffer, so clear the reference to allow GC
for i := 0; i < len(ts.Labels); i++ {
ts.Labels[i].Name = ""
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest // Name and Value may point into a large gRPC buffer, so clear the reference to allow GC

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I accepted your suggestion, thanks!

ts.Labels[i].Value = ""
}
ts.Labels = ts.Labels[:0]
ts.Samples = ts.Samples[:0]
timeSeriesPool.Put(ts)
Expand Down