mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
libc/cgroups: empty map in RemovePaths
RemovePaths() deletes elements from the paths map for paths that has been successfully removed. Although, it does not empty the map itself (which is needed that AFAIK Go garbage collector does not shrink the map), but all its callers do. Move this operation from callers to RemovePaths. No functional change, except the old map should be garbage collected now. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
@@ -223,17 +223,14 @@ func (m *legacyManager) Destroy() error {
|
||||
}
|
||||
unitName := getUnitName(m.cgroups)
|
||||
|
||||
err = stopUnit(dbusConnection, unitName)
|
||||
stopErr := stopUnit(dbusConnection, unitName)
|
||||
// Both on success and on error, cleanup all the cgroups we are aware of.
|
||||
// Some of them were created directly by Apply() and are not managed by systemd.
|
||||
if err := cgroups.RemovePaths(m.paths); err != nil {
|
||||
return err
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
m.paths = make(map[string]string)
|
||||
return nil
|
||||
|
||||
return stopErr
|
||||
}
|
||||
|
||||
func (m *legacyManager) Path(subsys string) string {
|
||||
|
||||
Reference in New Issue
Block a user