Created
December 17, 2016 17:08
-
-
Save cdfox/d3b5393796fdf2c16c6468e43a1150c3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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