预留最大内存总是设置为系统内存的20%

This commit is contained in:
GoEdgeLab
2023-10-01 16:09:49 +08:00
parent b322f74a72
commit eb556ddf44

View File

@@ -12,12 +12,6 @@ func setMaxMemory(memoryGB int) {
if memoryGB <= 0 {
memoryGB = 1
}
var maxMemoryBytes int64
if memoryGB > 10 {
maxMemoryBytes = int64(memoryGB-2) << 30 // 超过10G内存的允许剩余2G内存
} else {
maxMemoryBytes = (int64(memoryGB) << 30) * 80 / 100 // 默认 80%
}
var maxMemoryBytes = (int64(memoryGB) << 30) * 80 / 100 // 默认 80%
debug.SetMemoryLimit(maxMemoryBytes)
}