mirror of
https://github.com/minio/minio.git
synced 2024-12-26 07:05:55 -05:00
Add free() method for proxyReader to aggressively de-allocate Read data, to handle certain out of memory conditions
There are still some more out there
This commit is contained in:
parent
a4d20d1e75
commit
ac4d8fe478
@ -505,7 +505,12 @@ type proxyReader struct {
|
|||||||
object string
|
object string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *proxyReader) free(p []byte) {
|
||||||
|
p = nil
|
||||||
|
go debug.FreeOSMemory()
|
||||||
|
}
|
||||||
func (r *proxyReader) Read(p []byte) (n int, err error) {
|
func (r *proxyReader) Read(p []byte) (n int, err error) {
|
||||||
|
defer r.free(p)
|
||||||
n, err = r.reader.Read(p)
|
n, err = r.reader.Read(p)
|
||||||
if err == io.EOF || err == io.ErrUnexpectedEOF {
|
if err == io.EOF || err == io.ErrUnexpectedEOF {
|
||||||
ok := r.driver.objects.Append(r.object, p[0:n])
|
ok := r.driver.objects.Append(r.object, p[0:n])
|
||||||
@ -582,9 +587,6 @@ func (d donutDriver) CreateObject(bucketName, objectName, contentType, expectedM
|
|||||||
}
|
}
|
||||||
return "", iodine.New(err, errParams)
|
return "", iodine.New(err, errParams)
|
||||||
}
|
}
|
||||||
// free up
|
|
||||||
go debug.FreeOSMemory()
|
|
||||||
|
|
||||||
objectMetadata, err := d.donut.GetObjectMetadata(bucketName, objectName)
|
objectMetadata, err := d.donut.GetObjectMetadata(bucketName, objectName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", iodine.New(err, nil)
|
return "", iodine.New(err, nil)
|
||||||
|
Loading…
Reference in New Issue
Block a user