mirror of
https://github.com/rclone/rclone.git
synced 2024-11-25 09:41:44 +08:00
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
|
@ -3052,7 +3052,8 @@ 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 = info.StorageClass
|
||||
storageClass := *info.StorageClass // To prevent reference to large XML structures
|
||||
o.storageClass = &storageClass
|
||||
o.versionID = versionID
|
||||
} else if !o.fs.opt.NoHeadObject {
|
||||
err := o.readMetaData(ctx) // reads info and meta, returning an error
|
||||
|
|
Loading…
Reference in New Issue
Block a user