From 51b81334159472c16428d62613912210049fd821 Mon Sep 17 00:00:00 2001 From: daimaxiaxie Date: Fri, 8 Mar 2024 10:56:33 +0800 Subject: [PATCH] fix memory leak in NodeDeleteTracker --- .../core/scaledown/deletiontracker/nodedeletiontracker.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cluster-autoscaler/core/scaledown/deletiontracker/nodedeletiontracker.go b/cluster-autoscaler/core/scaledown/deletiontracker/nodedeletiontracker.go index d3d5a53b440b..5a9001629fe6 100644 --- a/cluster-autoscaler/core/scaledown/deletiontracker/nodedeletiontracker.go +++ b/cluster-autoscaler/core/scaledown/deletiontracker/nodedeletiontracker.go @@ -173,6 +173,9 @@ func (n *NodeDeletionTracker) ClearResultsNotNewerThan(t time.Time) { func (n *NodeDeletionTracker) Snapshot() *NodeDeletionTracker { n.Lock() defer n.Unlock() + + n.evictions.DropNotNewerThan(n.clock.Now().Add(-n.evictionsTTL)) + snapshot := NewNodeDeletionTracker(n.evictionsTTL) for k, val := range n.emptyNodeDeletions { snapshot.emptyNodeDeletions[k] = val