Skip to content

Instantly share code, notes, and snippets.

@davecheney
Created April 8, 2011 00:17
Show Gist options
  • Save davecheney/909061 to your computer and use it in GitHub Desktop.
Save davecheney/909061 to your computer and use it in GitHub Desktop.
package main
import (
"runtime"
"fmt"
"time"
)
func stats() {
for {
<-time.After(3e9)
fmt.Printf("CurrAlloc: %d, HeapAlloc: %d\n", runtime.MemStats.Alloc, runtime.MemStats.HeapAlloc)
}
}
func main() {
go stats()
for {
<-time.After(7e9)
runtime.GC()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment