mirror of
https://github.com/duanhf2012/origin.git
synced 2026-03-06 22:27:36 +08:00
增大内存池分布
This commit is contained in:
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user