From 1457ad548cbe8f3742217a302faf50fafeeaa4c5 Mon Sep 17 00:00:00 2001 From: amewayne Date: Wed, 10 Aug 2022 12:02:27 +0800 Subject: [PATCH] fix a memory leak problem when calling DryRunPreemption --- pkg/scheduler/framework/preemption/preemption.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/scheduler/framework/preemption/preemption.go b/pkg/scheduler/framework/preemption/preemption.go index c447297a846..5f2c0933f36 100644 --- a/pkg/scheduler/framework/preemption/preemption.go +++ b/pkg/scheduler/framework/preemption/preemption.go @@ -573,6 +573,7 @@ func (ev *Evaluator) DryRunPreemption(ctx context.Context, pod *v1.Pod, potentia nonViolatingCandidates := newCandidateList(numCandidates) violatingCandidates := newCandidateList(numCandidates) parallelCtx, cancel := context.WithCancel(ctx) + defer cancel() nodeStatuses := make(framework.NodeToStatusMap) var statusesLock sync.Mutex var errs []error