zoreide/memory.go

27 lines
320 B
Go
Raw Normal View History

2023-08-09 09:08:05 -05:00
package main
import (
2023-08-14 12:51:04 -05:00
"log"
2023-08-09 09:08:05 -05:00
"runtime"
"time"
)
func init() {
2023-08-14 12:51:04 -05:00
log.Println("Garbage Collector Thread Starting")
2023-08-09 09:08:05 -05:00
go memoryCleanerThread()
}
func memoryCleanerThread() {
for {
time.Sleep(10 * time.Minute)
2023-08-14 12:51:04 -05:00
log.Println("Time to clean memory...")
2023-08-09 09:08:05 -05:00
runtime.GC()
2023-08-14 12:51:04 -05:00
log.Println("Garbage Collection done.")
2023-08-09 09:08:05 -05:00
}
}