From 431ee1484e2606925aad94694066c668ca3711fd 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 5daf229ebb0..5d393dd16be 100644 --- a/pkg/scheduler/framework/preemption/preemption.go +++ b/pkg/scheduler/framework/preemption/preemption.go @@ -549,6 +549,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