mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-03 15:00:26 +08:00
优化脆片内存逻辑
This commit is contained in:
@@ -37,10 +37,15 @@ func NewMemoryWriter(memoryStorage *MemoryStorage, key string, expiredAt int64,
|
||||
if ok {
|
||||
valueItem.BodyValue = bodyBytes
|
||||
} else {
|
||||
if expectedBodySize >= minMemoryFragmentPoolItemSize {
|
||||
SharedFragmentMemoryPool.IncreaseNew()
|
||||
if isDirty {
|
||||
if expectedBodySize >= minMemoryFragmentPoolItemSize {
|
||||
SharedFragmentMemoryPool.IncreaseNew()
|
||||
}
|
||||
var allocSize = (expectedBodySize/16384 + 1) * 16384
|
||||
valueItem.BodyValue = make([]byte, allocSize)[:expectedBodySize]
|
||||
} else {
|
||||
valueItem.BodyValue = make([]byte, expectedBodySize)
|
||||
}
|
||||
valueItem.BodyValue = make([]byte, expectedBodySize)
|
||||
}
|
||||
|
||||
valueItem.IsPrepared = true
|
||||
|
||||
Reference in New Issue
Block a user