diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index bd77728d3..e7815b06e 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -23,6 +23,7 @@ The following tip changes can be tested by building VictoriaMetrics components f * BUGFIX: [Graphite Render API](https://docs.victoriametrics.com/#graphite-render-api-usage): return an additional point after `until` timestamp in the same way as Graphite does. Previously VictoriaMetrics didn't return this point, which could result in missing last point on the graph. * BUGFIX: properly locate series with the given `name` and without the given `label` when using the `name{label=~"foo|"}` series selector. Previously such series could be skipped. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2255). Thanks to @jduncan0000 for discovering and fixing the issue. +* BUGFIX: properly free up memory occupied by deleted cache entries for the following caches: `indexdb/dataBlocks`, `indexdb/indexBlocks`, `storage/indexBlocks`. This should reduce the increased memory usage starting from v1.73.0. See [this](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2242) and [this](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2007) issue. ## [v1.74.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.74.0) diff --git a/lib/blockcache/blockcache.go b/lib/blockcache/blockcache.go index 1737e0f3c..86727e353 100644 --- a/lib/blockcache/blockcache.go +++ b/lib/blockcache/blockcache.go @@ -396,6 +396,10 @@ func (lah *lastAccessHeap) Push(x interface{}) { func (lah *lastAccessHeap) Pop() interface{} { h := *lah e := h[len(h)-1] + + // Remove the reference to deleted entry, so Go GC could free up memory occupied by the deleted entry. + h[len(h)-1] = nil + *lah = h[:len(h)-1] return e }