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.
This commit is contained in:
Nick Craig-Wood 2022-12-13 11:50:51 +00:00
parent c446651be8
commit 43bf177ff7
1 changed files with 1 additions and 1 deletions

View File

@ -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 {