fix: limit manual GC to bigger objects (#4581)

This commit is contained in:
Klaus Post
2023-05-26 08:12:10 -07:00
committed by GitHub
parent 7415469c72
commit 96cb5cfc44
+4 -1
View File
@@ -195,7 +195,10 @@ func (p *ParallelManager) enoughMemForUpload(uploadSize int64) bool {
}
smem := runtime.MemStats{}
runtime.GC()
if uploadSize > 50<<20 {
// GC if upload is bigger than 50MB.
runtime.GC()
}
runtime.ReadMemStats(&smem)
return estimateNeededMemoryForUpload(uploadSize)+smem.Alloc < p.maxMem