Optimize memory usage

This commit is contained in:
DarthSim
2017-09-28 19:43:21 +06:00
parent 02a9ed4210
commit 6d840c7cb6
3 changed files with 19 additions and 5 deletions

View File

@@ -4,12 +4,20 @@ import (
"log"
"net"
"net/http"
"runtime/debug"
"time"
"golang.org/x/net/netutil"
)
func main() {
// Force garbage collection
go func() {
for _ = range time.Tick(time.Second) {
debug.FreeOSMemory()
}
}()
l, err := net.Listen("tcp", conf.Bind)
if err != nil {
log.Fatal(err)