Skip to content

Instantly share code, notes, and snippets.

@qnighy
Created July 5, 2018 14:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qnighy/135087a209cfa81e6e0da2e351dfd098 to your computer and use it in GitHub Desktop.
Save qnighy/135087a209cfa81e6e0da2e351dfd098 to your computer and use it in GitHub Desktop.
package main
func main() {
ch := make(chan int)
x := make([]int, 10)
go (func() {
y := make([]int, 10)
for i := 0; i < 1000000; i++ {
z := x
z[len(z)-1] = -1
x = y
}
ch <- 0
})();
go (func() {
y := make([]int, 1000000)
for i := 0; i < 1000000; i++ {
z := x
z[len(z)-1] = -1
x = y
}
ch <- 0
})();
<- ch
<- ch
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment