From 43bf177ff71d164c9877546c33b171379cda0bc9 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Tue, 13 Dec 2022 11:50:51 +0000 Subject: [PATCH] s3: fix excess memory usage when using versions Before this change, we were taking the version ID straight from the XML blob returned by the SDK and thus pinning the XML into memory which bulked up the average memory per object from about 400 bytes to 4k. Copying the string fixes the excess memory usage. --- backend/s3/s3.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/s3/s3.go b/backend/s3/s3.go index 286ebb283..c943dc800 100644 --- a/backend/s3/s3.go +++ b/backend/s3/s3.go @@ -3093,7 +3093,7 @@ func (f *Fs) newObjectWithInfo(ctx context.Context, remote string, info *s3.Obje o.setMD5FromEtag(aws.StringValue(info.ETag)) o.bytes = aws.Int64Value(info.Size) o.storageClass = stringClonePointer(info.StorageClass) - o.versionID = versionID + o.versionID = stringClonePointer(versionID) } else if !o.fs.opt.NoHeadObject { err := o.readMetaData(ctx) // reads info and meta, returning an error if err != nil {