- tasksch中,任务完成后要将worker置空,否则被管理的任务的worker会hold住大量对象

This commit is contained in:
gazebo
2019-08-29 11:19:54 +08:00
parent 4ad77227d6
commit 6c805edf92
3 changed files with 4 additions and 1 deletions

View File

@@ -24,6 +24,6 @@ func (m *SyncMapWithTimeout) Delete(key interface{}) {
if value, ok := m.timers.Load(key); ok {
timer := value.(*time.Timer)
timer.Stop()
}
m.timers.Delete(key)
}
}

View File

@@ -179,6 +179,7 @@ func (task *ParallelTask) Run() {
close(task.subFinishChan)
task.jobList = nil // 如果不释放,任务被管理的话,会导致内存不能释放
task.worker = nil
})
}

View File

@@ -59,6 +59,8 @@ func (task *SeqTask) Run() {
task.Result = taskResult
task.mainErr = taskErr
task.locker.Unlock()
task.worker = nil
})
}