It looks this line 
https://github.com/golang/go/blob/master/src/runtime/stack.go#L1078 never 
gets executed.

An example:

package main

const N = 512 * 1024 * 1024 // 500M
var v byte = 123

func main() {
    var s = []byte{N: 0}
    for i := range s { s[i] = v }
    println(s[v]) 
}

I added a println line: println (oldsize, "=>", newsize)
at L#1078: 
https://github.com/golang/go/blob/master/src/runtime/stack.go#L1078
and got the following output:

2048 => 4096
4096 => 8192
8192 => 16384
16384 => 32768
32768 => 65536
65536 => 131072
131072 => 262144
262144 => 524288
524288 => 1048576
1048576 => 2097152
2097152 => 4194304
4194304 => 8388608
8388608 => 16777216
16777216 => 33554432
33554432 => 67108864
67108864 => 134217728
134217728 => 268435456
268435456 => 536870912
536870912 => 1073741824
runtime: goroutine stack exceeds 1000000000-byte limit
runtime: sp=0xc0400dff70 stack=[0xc0200e0000, 0xc0400e0000]
fatal error: stack overflow

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/89208bd7-8bb7-443a-8bdb-8903c0a546ffn%40googlegroups.com.

Reply via email to