Last active
December 13, 2016 19:09
-
-
Save arya/7e23e8654e87a6e80608ade43ee31041 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" | |
"os/exec" | |
"syscall" | |
"time" | |
) | |
func main() { | |
var s []*[1024 * 1024]byte | |
for i := 0; ; i++ { | |
start := time.Now() | |
for j := 0; j < 100; j++ { | |
cmd := exec.Command("echo") | |
cmd.SysProcAttr = &syscall.SysProcAttr{} | |
cmd.SysProcAttr.Cloneflags = syscall.CLONE_VFORK | |
cmd.Run() | |
} | |
fmt.Printf("%dGB: %s\n", i, time.Now().Sub(start)/time.Duration(100)) | |
if i == 3 { | |
break | |
} | |
for j := 0; j < 1024; j++ { | |
s = append(s, new([1024 * 1024]byte)) | |
cmd := exec.Command("echo") | |
cmd.SysProcAttr = &syscall.SysProcAttr{} | |
cmd.SysProcAttr.Cloneflags = syscall.CLONE_VFORK | |
cmd.Run() | |
} | |
} | |
} |
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" | |
"os/exec" | |
"time" | |
) | |
func main() { | |
var s []*[1024 * 1024]byte | |
for i := 0; ; i++ { | |
start := time.Now() | |
for j := 0; j < 100; j++ { | |
exec.Command("echo").Run() | |
} | |
fmt.Printf("%dGB: %s\n", i, time.Now().Sub(start)/time.Duration(100)) | |
if i == 3 { | |
break | |
} | |
for j := 0; j < 1024; j++ { | |
s = append(s, new([1024 * 1024]byte)) | |
exec.Command("echo").Run() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment