mirror of
https://github.com/minio/minio.git
synced 2025-01-27 14:43:18 -05:00
fix: get rid of large buffers (#19549)
these lead to run-away usage of memory beyond which the Go's GC can handle, we have to re-visit this differently, remove this for now.
This commit is contained in:
parent
108e6f92d4
commit
03767d26da
@ -2124,14 +2124,6 @@ func (s *xlStorage) writeAllDirect(ctx context.Context, filePath string, fileSiz
|
|||||||
|
|
||||||
var bufp *[]byte
|
var bufp *[]byte
|
||||||
switch {
|
switch {
|
||||||
case fileSize > 0 && fileSize >= xioutil.XXLargeBlock*2:
|
|
||||||
// use a larger 8MiB buffer for a really really large streamsx.
|
|
||||||
bufp = xioutil.ODirectPoolXXLarge.Get().(*[]byte)
|
|
||||||
defer xioutil.ODirectPoolXXLarge.Put(bufp)
|
|
||||||
case fileSize > 0 && fileSize >= xioutil.XLargeBlock:
|
|
||||||
// use a larger 4MiB buffer for a really large streams.
|
|
||||||
bufp = xioutil.ODirectPoolXLarge.Get().(*[]byte)
|
|
||||||
defer xioutil.ODirectPoolXLarge.Put(bufp)
|
|
||||||
case fileSize <= xioutil.SmallBlock:
|
case fileSize <= xioutil.SmallBlock:
|
||||||
bufp = xioutil.ODirectPoolSmall.Get().(*[]byte)
|
bufp = xioutil.ODirectPoolSmall.Get().(*[]byte)
|
||||||
defer xioutil.ODirectPoolSmall.Put(bufp)
|
defer xioutil.ODirectPoolSmall.Put(bufp)
|
||||||
|
@ -34,26 +34,12 @@ import (
|
|||||||
|
|
||||||
// Block sizes constant.
|
// Block sizes constant.
|
||||||
const (
|
const (
|
||||||
SmallBlock = 32 * humanize.KiByte // Default r/w block size for smaller objects.
|
SmallBlock = 32 * humanize.KiByte // Default r/w block size for smaller objects.
|
||||||
LargeBlock = 1 * humanize.MiByte // Default r/w block size for normal objects.
|
LargeBlock = 1 * humanize.MiByte // Default r/w block size for normal objects.
|
||||||
XLargeBlock = 4 * humanize.MiByte // Default r/w block size for very large objects.
|
|
||||||
XXLargeBlock = 8 * humanize.MiByte // Default r/w block size for very very large objects.
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// aligned sync.Pool's
|
// aligned sync.Pool's
|
||||||
var (
|
var (
|
||||||
ODirectPoolXXLarge = sync.Pool{
|
|
||||||
New: func() interface{} {
|
|
||||||
b := disk.AlignedBlock(XXLargeBlock)
|
|
||||||
return &b
|
|
||||||
},
|
|
||||||
}
|
|
||||||
ODirectPoolXLarge = sync.Pool{
|
|
||||||
New: func() interface{} {
|
|
||||||
b := disk.AlignedBlock(XLargeBlock)
|
|
||||||
return &b
|
|
||||||
},
|
|
||||||
}
|
|
||||||
ODirectPoolLarge = sync.Pool{
|
ODirectPoolLarge = sync.Pool{
|
||||||
New: func() interface{} {
|
New: func() interface{} {
|
||||||
b := disk.AlignedBlock(LargeBlock)
|
b := disk.AlignedBlock(LargeBlock)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user