增大内存池分布

This commit is contained in:
orgin
2022-03-04 10:56:59 +08:00
parent 83b90f285b
commit 93be70877b

View File

@@ -16,8 +16,7 @@ type memAreaPool struct {
pool []sync.Pool pool []sync.Pool
} }
//小于2048时按64步长增长.>2048时则按2048长度增长 var memAreaPoolList = [3]*memAreaPool{&memAreaPool{minAreaValue: 1, maxAreaValue: 4096, growthValue: 512}, &memAreaPool{minAreaValue: 4097, maxAreaValue: 40960, growthValue: 4096}, &memAreaPool{minAreaValue: 40961, maxAreaValue: 417792, growthValue: 16384}}
var memAreaPoolList = [2]*memAreaPool{&memAreaPool{minAreaValue:1,maxAreaValue: 2048,growthValue:64}, &memAreaPool{minAreaValue: 2049,maxAreaValue:65536,growthValue:2048}}
func init() { func init() {
for i := 0; i < len(memAreaPoolList); i++ { for i := 0; i < len(memAreaPoolList); i++ {
@@ -77,7 +76,7 @@ func (areaPool *memAreaPool) MakeByteSlice(size int) []byte{
} }
} }
return nil return make([]byte, size)
} }
func (areaPool *memAreaPool) ReleaseByteSlice(byteBuff []byte) bool { func (areaPool *memAreaPool) ReleaseByteSlice(byteBuff []byte) bool {