mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-10-09 19:52:30 +02:00
Optimize memory usage
This commit is contained in:
8
main.go
8
main.go
@@ -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)
|
||||
|
Reference in New Issue
Block a user