github.com/fjl/memsize@v0.0.2/memsizedemo/main.go (about)

     1  package main
     2  
     3  import (
     4  	"log"
     5  	"net/http"
     6  
     7  	"github.com/fjl/memsize/memsizeui"
     8  )
     9  
    10  func main() {
    11  	byteslice := make([]byte, 200)
    12  	intslice := make([]int, 100)
    13  
    14  	h := new(memsizeui.Handler)
    15  	s := &http.Server{Addr: "127.0.0.1:8080", Handler: h}
    16  	h.Add("byteslice", &byteslice)
    17  	h.Add("intslice", &intslice)
    18  	h.Add("server", s)
    19  	log.Println("listening on http://127.0.0.1:8080")
    20  	s.ListenAndServe()
    21  }