mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2026-01-03 04:26:35 +08:00
优化计数器内存使用
This commit is contained in:
@@ -24,9 +24,9 @@ func NewItem(lifeSeconds int) *Item {
|
||||
spanSeconds = 1
|
||||
}
|
||||
var countSpans = lifeSeconds/spanSeconds + 1 /** prevent index out of bounds **/
|
||||
var spans = []*Span{}
|
||||
var spans = make([]*Span, countSpans)
|
||||
for i := 0; i < countSpans; i++ {
|
||||
spans = append(spans, NewSpan())
|
||||
spans[i] = NewSpan()
|
||||
}
|
||||
|
||||
return &Item{
|
||||
|
||||
Reference in New Issue
Block a user