Created
April 7, 2011 11:47
-
-
Save davecheney/907622 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 ( | |
"runtime" | |
"fmt" | |
"time" | |
"net" | |
) | |
func print() { | |
for { | |
<-time.After(10e9) | |
fmt.Println(runtime.MemStats.Alloc, runtime.MemStats.HeapAlloc) | |
} | |
} | |
func main() { | |
go print() | |
addr, _ := net.ResolveTCPAddr(":12345") | |
l, err := net.ListenTCP("tcp", addr) | |
if err != nil { | |
panic(err) | |
} | |
for { | |
c, err := l.Accept() | |
if err != nil { | |
panic(err) | |
} | |
c.Close() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment