You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I use the following code in a program, it causes a memory leak. It's a strange phenomenon, as long as you comment out the upload logic.And the memory usage obtained by using pprof is inconsistent with the actual memory usage.
forpath:=rangeb.buff {
file, err:=os.Open(path)
iferr!=nil {
su_logger.Error(context.Background(), err, fmt.Sprintf("Failed to open file:%s", path))
b.FileUnlock(path)
continue
}
......uploader:=s3manager.NewUploader(b.sess)
_, err=uploader.Upload(&s3manager.UploadInput{
Bucket: aws.String(global.GetConfig().AwsS3Config.Bucket),
Key: aws.String(strings.TrimLeft(path, "/backup")),
Body: file,
})
iferr=file.Close(); err!=nil {
su_logger.Error(context.Background(), err, fmt.Sprintf("Failed to close file: %s", path))
}
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
When I use the following code in a program, it causes a memory leak. It's a strange phenomenon, as long as you comment out the upload logic.And the memory usage obtained by using pprof is inconsistent with the actual memory usage.
Beta Was this translation helpful? Give feedback.
All reactions