Last active
May 2, 2017 00:09
-
-
Save flebel/d0a16fc3af2b63b4730b1da5a8b947fa 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" | |
"time" | |
) | |
func doEvery(d time.Duration, f func(time.Time)) { | |
for x := range time.Tick(d) { | |
SmallSlab = append(SmallSlab, make([]byte, 1024*1024)...) | |
f(x) | |
} | |
} | |
func printTime(t time.Time) { | |
fmt.Printf("%v\n", t) | |
} | |
// Slab of allocated memory | |
var Slab []byte | |
var SmallSlab []byte | |
func main() { | |
Slab = make([]byte, 1024*1024*1024*5) // 5GB | |
SmallSlab = make([]byte, 1024) | |
doEvery(500*time.Millisecond, printTime) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment