From ba74d6e6ecc2cc8e1480a466e29a078a93e24afa Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Tue, 28 Sep 2021 17:01:22 +0200 Subject: 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 --- libpod/kube.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libpod/kube.go') diff --git a/libpod/kube.go b/libpod/kube.go index e6b9b0477..b92753f1b 100644 --- a/libpod/kube.go +++ b/libpod/kube.go @@ -90,7 +90,7 @@ func (p *Pod) GenerateForKube(ctx context.Context) (*v1.Pod, []v1.ServicePort, e // so set it at here for _, ctr := range allContainers { if !ctr.IsInfra() { - switch ctr.Config().RestartPolicy { + switch ctr.config.RestartPolicy { case define.RestartPolicyAlways: pod.Spec.RestartPolicy = v1.RestartPolicyAlways case define.RestartPolicyOnFailure: -- cgit v1.2.3-54-g00ecf