fix free os

This commit is contained in:
yourok
2020-02-14 12:47:00 +03:00
parent 42770cecb6
commit fa1c705695

View File

@@ -20,18 +20,9 @@ func FreeOSMem() {
debug.FreeOSMemory()
}
func FreeOSMemGC(maxAlloc int64) {
if maxAlloc <= 0 {
runtime.GC()
debug.FreeOSMemory()
return
}
var m runtime.MemStats
runtime.ReadMemStats(&m)
if m.Alloc > uint64(float32(maxAlloc)*2) {
runtime.GC()
debug.FreeOSMemory()
}
func FreeOSMemGC() {
runtime.GC()
debug.FreeOSMemory()
}
const (