Created
May 15, 2014 09:15
-
-
Save lintianzhi/733bcf631e5987a673d3 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 ( | |
"runtime/debug" | |
"time" | |
) | |
func main() { | |
m := int64(1024*1024) * 100 | |
for i := 1; i < 10; i++ { | |
test(m * int64(i)) | |
} | |
debug.FreeOSMemory() | |
time.Sleep(time.Second * 100) | |
} | |
func test(n int64) { | |
b := make([]byte, n) | |
b[1] = 'a' | |
b[n-1] = 'z' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment