mirror of
https://github.com/rclone/rclone
synced 2024-11-21 22:50:16 +01: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