mirror of
				https://github.com/TeaOSLab/EdgeNode.git
				synced 2025-11-04 07:40:56 +08:00 
			
		
		
		
	优化脆片内存逻辑
This commit is contained in:
		@@ -37,11 +37,16 @@ func NewMemoryWriter(memoryStorage *MemoryStorage, key string, expiredAt int64,
 | 
			
		||||
		if ok {
 | 
			
		||||
			valueItem.BodyValue = bodyBytes
 | 
			
		||||
		} else {
 | 
			
		||||
			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.IsPrepared = true
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user