Merge pull request #104991 from hzxuzhonghu/mem-leak

Fix workqueue memory leak
This commit is contained in:
Kubernetes Prow Robot 2021-09-14 22:42:41 -07:00 committed by GitHub
commit 4c014e5ca4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -161,7 +161,10 @@ func (q *Type) Get() (item interface{}, shutdown bool) {
return nil, true
}
item, q.queue = q.queue[0], q.queue[1:]
item = q.queue[0]
// The underlying array still exists and reference this object, so the object will not be garbage collected.
q.queue[0] = nil
q.queue = q.queue[1:]
q.metrics.get(item)