mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-07 02:20:25 +08:00
预留最大内存总是设置为系统内存的20%
This commit is contained in:
@@ -12,12 +12,6 @@ func setMaxMemory(memoryGB int) {
|
|||||||
if memoryGB <= 0 {
|
if memoryGB <= 0 {
|
||||||
memoryGB = 1
|
memoryGB = 1
|
||||||
}
|
}
|
||||||
var maxMemoryBytes int64
|
var maxMemoryBytes = (int64(memoryGB) << 30) * 80 / 100 // 默认 80%
|
||||||
if memoryGB > 10 {
|
|
||||||
maxMemoryBytes = int64(memoryGB-2) << 30 // 超过10G内存的允许剩余2G内存
|
|
||||||
} else {
|
|
||||||
maxMemoryBytes = (int64(memoryGB) << 30) * 80 / 100 // 默认 80%
|
|
||||||
}
|
|
||||||
|
|
||||||
debug.SetMemoryLimit(maxMemoryBytes)
|
debug.SetMemoryLimit(maxMemoryBytes)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user