0
I have a code sort of with this structure:
package main
import (
"html/template"
"net/http"
"log"
)
func main() {
http.HandleFunc("/",taltal)
http.ListenAndServe(":8080",nil)
}
func check(err error){
if err != nil{
log.Fatal(err)
}
}
func taltal(w http.ResponseWriter, r *http.Request){
if r.Method == "GET"{
t,err := template.ParseFiles("request.html")
check(err)
t.Execute(w,nil)
}
}
This code simply creates a server with whatever you have in the file request.html
and he performs in localhost:8080
, see which routes I define in http.HandleFunc("/",taltal)
.
I could notice that in the task manager, even when the server was idle, the use of memory never decreased, only increased according to the number of calls I made to the server.
Initial state:
After making some requests:
And the use of memory never diminishes, even when the server is idle.
How I release the memory that is no longer being used and at the same time do not stop the server?