This is my new blog CMS https://jlelse.blog
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

24 lines
373 B

package main
import (
"log"
"runtime"
"time"
)
func initGC() {
go func() {
ticker := time.NewTicker(10 * time.Minute)
for range ticker.C {
go doGC()
}
}()
}
func doGC() {
var old, new runtime.MemStats
runtime.ReadMemStats(&old)
runtime.GC()
runtime.ReadMemStats(&new)
log.Printf("Alloc: %v MiB → %v MiB", old.Alloc/1024/1024, new.Alloc/1024/1024)
}