Skip to content

Commit

Permalink
debug: attempt to sort oom killing issue by explicitly releasing memory
Browse files Browse the repository at this point in the history
  • Loading branch information
muety committed Jan 5, 2024
1 parent fae0128 commit 2ded3ba
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
"net"
"net/http"
"os"
"runtime"
"runtime/debug"
"strconv"
"time"

Expand Down Expand Up @@ -329,6 +331,14 @@ func main() {
}()
}

go func() {
for {
time.Sleep(1 * time.Minute)
runtime.GC()
debug.FreeOSMemory()
}
}()

// Listen HTTP
listen(router)
}
Expand Down

0 comments on commit 2ded3ba

Please sign in to comment.