Skip to content

Instantly share code, notes, and snippets.

@cdfox
Created December 17, 2016 17:08
Show Gist options
  • Save cdfox/d3b5393796fdf2c16c6468e43a1150c3 to your computer and use it in GitHub Desktop.
Save cdfox/d3b5393796fdf2c16c6468e43a1150c3 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"log"
"net/http"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
// server continues serving requests when request goroutine panics
//panic("panic!!!")
// get out of memory error -- server exits with "signal: killed"
slc := make([]int64, 1000000000)
for {
slc = append(slc, 1)
}
fmt.Fprintf(w, "Hello, %s", r.URL.Path)
})
log.Fatal(http.ListenAndServe(":12345", nil))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment