mirror of
https://github.com/duanhf2012/origin.git
synced 2026-02-15 00:04:46 +08:00
优化网络内存池
This commit is contained in:
@@ -5,8 +5,7 @@ import (
|
||||
)
|
||||
|
||||
type INetMempool interface {
|
||||
MakeReadByteSlice(size int) []byte
|
||||
MakeWriteByteSlice(size int) []byte
|
||||
MakeByteSlice(size int) []byte
|
||||
ReleaseByteSlice(byteBuff []byte) bool
|
||||
}
|
||||
|
||||
@@ -81,14 +80,6 @@ func (areaPool *memAreaPool) MakeByteSlice(size int) []byte{
|
||||
return nil
|
||||
}
|
||||
|
||||
func (areaPool *memAreaPool) MakeReadByteSlice(size int) []byte{
|
||||
return areaPool.MakeByteSlice(size)
|
||||
}
|
||||
|
||||
func (areaPool *memAreaPool) MakeWriteByteSlice(size int) []byte{
|
||||
return areaPool.MakeByteSlice(size)
|
||||
}
|
||||
|
||||
func (areaPool *memAreaPool) ReleaseByteSlice(byteBuff []byte) bool {
|
||||
for i:=0;i<len(memAreaPoolList);i++{
|
||||
if cap(byteBuff) <= memAreaPoolList[i].maxAreaValue {
|
||||
|
||||
Reference in New Issue
Block a user