From 98176f001863fd138025c48625eda5c5adb26972 Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Wed, 29 Sep 2021 10:58:27 +0200 Subject: 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 --- 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 d17ca1114..f5ca74d53 100644 --- a/libpod/kube.go +++ b/libpod/kube.go @@ -424,7 +424,7 @@ func containerToV1Container(ctx context.Context, c *Container) (v1.Container, [] // NOTE: a privileged container mounts all of /dev/*. if !c.Privileged() && len(c.config.Spec.Linux.Devices) > 0 { // TODO Enable when we can support devices and their names - kubeContainer.VolumeDevices = generateKubeVolumeDeviceFromLinuxDevice(c.Spec().Linux.Devices) + kubeContainer.VolumeDevices = generateKubeVolumeDeviceFromLinuxDevice(c.config.Spec.Linux.Devices) return kubeContainer, kubeVolumes, nil, errors.Wrapf(define.ErrNotImplemented, "linux devices") } -- cgit v1.2.3-54-g00ecf