mirror of https://github.com/milvus-io/milvus.git
Fix GCTuner calculation overflow (#20354)
Signed-off-by: xiaofan-luan <xiaofan.luan@zilliz.com> Signed-off-by: xiaofan-luan <xiaofan.luan@zilliz.com>pull/20368/head
parent
709a0a94e9
commit
0d18336b21
|
@ -60,11 +60,16 @@ func optimizeGOGC() {
|
|||
totaluse := hardware.GetUsedMemoryCount()
|
||||
heapTarget := memoryThreshold - (totaluse - heapuse)
|
||||
|
||||
newGoGC := uint32(math.Floor(float64(heapTarget-heapuse) / float64(heapuse) * 100))
|
||||
if newGoGC < minGOGC {
|
||||
var newGoGC uint32
|
||||
if heapTarget < heapuse {
|
||||
newGoGC = minGOGC
|
||||
} else if newGoGC > maxGOGC {
|
||||
newGoGC = maxGOGC
|
||||
} else {
|
||||
newGoGC = uint32(math.Floor(float64(heapTarget-heapuse) / float64(heapuse) * 100))
|
||||
if newGoGC < minGOGC {
|
||||
newGoGC = minGOGC
|
||||
} else if newGoGC > maxGOGC {
|
||||
newGoGC = maxGOGC
|
||||
}
|
||||
}
|
||||
|
||||
action(newGoGC)
|
||||
|
|
Loading…
Reference in New Issue