Created
March 27, 2016 20:12
-
-
Save collinvandyck/a7aa64473a89113798e7 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 ( | |
| "fmt" | |
| "runtime" | |
| "time" | |
| ) | |
| func main() { | |
| go func() { | |
| for i := 0; i < 100000; i++ { | |
| <-time.After(10 * time.Millisecond) | |
| } | |
| }() | |
| ms := &runtime.MemStats{} | |
| for _ = range time.Tick(time.Second) { | |
| runtime.GC() | |
| runtime.ReadMemStats(ms) | |
| fmt.Printf("%d Alloc - %d Frees - %d HeapObjects - %d HeapReleased - %d HeapInuse\n", ms.Alloc, ms.Frees, ms.HeapObjects, ms.HeapReleased, ms.HeapInuse) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment