s3: reduce memory consumption for s3 objects
Copying the storageClass string instead of using a pointer to the original string. This prevents the Go garbage collector from keeping large amounts of XMLNode structs and references in memory, created by xmlutil.XMLToStruct() from the aws-sdk-go.
This commit is contained in:
parent
1628ca0d46
commit
a9bd0c8de6
1 changed files with 2 additions and 1 deletions
|
@ -3052,7 +3052,8 @@ func (f *Fs) newObjectWithInfo(ctx context.Context, remote string, info *s3.Obje
|
||||||
}
|
}
|
||||||
o.setMD5FromEtag(aws.StringValue(info.ETag))
|
o.setMD5FromEtag(aws.StringValue(info.ETag))
|
||||||
o.bytes = aws.Int64Value(info.Size)
|
o.bytes = aws.Int64Value(info.Size)
|
||||||
o.storageClass = info.StorageClass
|
storageClass := *info.StorageClass // To prevent reference to large XML structures
|
||||||
|
o.storageClass = &storageClass
|
||||||
o.versionID = versionID
|
o.versionID = versionID
|
||||||
} else if !o.fs.opt.NoHeadObject {
|
} else if !o.fs.opt.NoHeadObject {
|
||||||
err := o.readMetaData(ctx) // reads info and meta, returning an error
|
err := o.readMetaData(ctx) // reads info and meta, returning an error
|
||||||
|
|
Loading…
Reference in a new issue