summaryrefslogtreecommitdiff
path: root/libpod/container_internal.go
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2021-09-29 10:58:27 +0200
committerValentin Rothberg <rothberg@redhat.com>2021-09-29 13:44:39 +0200
commit98176f001863fd138025c48625eda5c5adb26972 (patch)
treebc4be5ce8379ee9f6d9da1b96cf66f82f22cdae7 /libpod/container_internal.go
parent453c49c488dd6518b33393e04c04ebc32ce61ee9 (diff)
downloadpodman-98176f001863fd138025c48625eda5c5adb26972.tar.gz
podman-98176f001863fd138025c48625eda5c5adb26972.tar.bz2
podman-98176f001863fd138025c48625eda5c5adb26972.zip
libpod: do not call (*container).Spec()
Access the container's spec field directly inside of libpod instead of calling Spec() which in turn creates expensive JSON deep copies. Accessing the field directly drops memory consumption of a simple podman run --rm busybox true from ~700kB to ~600kB. [NO TESTS NEEDED] Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'libpod/container_internal.go')
-rw-r--r--libpod/container_internal.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go
index e81f2ec5f..3f9738411 100644
--- a/libpod/container_internal.go
+++ b/libpod/container_internal.go
@@ -2004,7 +2004,7 @@ func (c *Container) setupOCIHooks(ctx context.Context, config *spec.Spec) (map[s
}
return nil, err
}
- ociHooks, err := manager.Hooks(config, c.Spec().Annotations, len(c.config.UserVolumes) > 0)
+ ociHooks, err := manager.Hooks(config, c.config.Spec.Annotations, len(c.config.UserVolumes) > 0)
if err != nil {
return nil, err
}
@@ -2021,7 +2021,7 @@ func (c *Container) setupOCIHooks(ctx context.Context, config *spec.Spec) (map[s
return nil, err
}
- allHooks, err = manager.Hooks(config, c.Spec().Annotations, len(c.config.UserVolumes) > 0)
+ allHooks, err = manager.Hooks(config, c.config.Spec.Annotations, len(c.config.UserVolumes) > 0)
if err != nil {
return nil, err
}