// Copyright 2019 github.com. All rights reserved. // Use of this source code is governed by github.com. package util import ( "runtime/debug" "time" ) // FreeOSMemory 强制回放内存资源 func FreeOSMemory() { // 每一小时触发一次 t := time.NewTicker(time.Hour) defer t.Stop() go func() { for { <-t.C debug.FreeOSMemory() } }() }