mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-06 01:50:25 +08:00
优化可用内存检查
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
//go:build !windows
|
||||||
// +build !windows
|
// +build !windows
|
||||||
|
|
||||||
package nodes
|
package nodes
|
||||||
@@ -31,7 +32,7 @@ func (this *NodeStatusExecutor) updateMem(status *nodeconfigs.NodeStatus) {
|
|||||||
if minFreeMemory > 1<<30 {
|
if minFreeMemory > 1<<30 {
|
||||||
minFreeMemory = 1 << 30
|
minFreeMemory = 1 << 30
|
||||||
}
|
}
|
||||||
if stat.Free < minFreeMemory {
|
if stat.Available > 0 && stat.Available < minFreeMemory {
|
||||||
runtime.GC()
|
runtime.GC()
|
||||||
debug.FreeOSMemory()
|
debug.FreeOSMemory()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user