Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/statistics/handle/cache/internal/lfu/lfu_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ func NewLFU(totalMemCost int64) (*LFU, error) {
}

// adjustMemCost adjusts the memory cost according to the total memory cost.
// When the total memory cost is 0, the memory cost is set to half of the total memory.
// When the total memory cost is 0, the memory cost is set to 20% of the total memory.
func adjustMemCost(totalMemCost int64) (result int64, err error) {
if totalMemCost == 0 {
memTotal, err := memory.MemTotal()
if err != nil {
return 0, err
}
return int64(memTotal / 2), nil
return int64(memTotal * 20 / 100), nil
}
return totalMemCost, nil
}
Expand Down