summaryrefslogtreecommitdiff
path: root/libpod/pod.go
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2021-09-28 17:01:22 +0200
committerMatthew Heon <matthew.heon@pm.me>2021-09-29 16:39:29 -0400
commitba74d6e6ecc2cc8e1480a466e29a078a93e24afa (patch)
treec5051bfcdcdc6363d1b4dabfa71eb7132500bd64 /libpod/pod.go
parenta1199dbaf1e42de665a8fc40ba0dd17d21f05ab7 (diff)
downloadpodman-ba74d6e6ecc2cc8e1480a466e29a078a93e24afa.tar.gz
podman-ba74d6e6ecc2cc8e1480a466e29a078a93e24afa.tar.bz2
podman-ba74d6e6ecc2cc8e1480a466e29a078a93e24afa.zip
libpod: do not call (*container).Config()
Access the container's config field directly inside of libpod instead of calling `Config()` which in turn creates expensive JSON deep copies. Accessing the field directly drops memory consumption of a simple `podman run --rm busybox true` from 1245kB to 410kB. [NO TESTS NEEDED] Signed-off-by: Valentin Rothberg <rothberg@redhat.com> <MH: Fixed cherry-pick conflicts>
Diffstat (limited to 'libpod/pod.go')
-rw-r--r--libpod/pod.go6
1 files changed, 2 insertions, 4 deletions
diff --git a/libpod/pod.go b/libpod/pod.go
index 0d5d629cd..d9db06285 100644
--- a/libpod/pod.go
+++ b/libpod/pod.go
@@ -104,8 +104,7 @@ func (p *Pod) PidMode() string {
if err != nil {
return ""
}
- conf := infra.Config()
- ctrSpec := conf.Spec
+ ctrSpec := infra.config.Spec
if ctrSpec != nil && ctrSpec.Linux != nil {
for _, ns := range ctrSpec.Linux.Namespaces {
if ns.Type == specs.PIDNamespace {
@@ -126,8 +125,7 @@ func (p *Pod) UserNSMode() string {
if err != nil {
return ""
}
- conf := infra.Config()
- ctrSpec := conf.Spec
+ ctrSpec := infra.config.Spec
if ctrSpec != nil && ctrSpec.Linux != nil {
for _, ns := range ctrSpec.Linux.Namespaces {
if ns.Type == specs.UserNamespace {