golang 建立超過10萬個Go程時報錯stackcacherefill

package main

import(
    //"fmt"
    "time"
)
var c = make(chan int,100)

func gofunc(){
    time.Sleep(0)
    c<-0
}
func main(){
    for i:=0;i<10;i++{
        for j:=0;j<10000;j++{
            go gofunc()    
        }
        time.Sleep(time.Second)
    }
}


fatal error: out of memory (stackcacherefill)spa


runtime stack:code

runtime.throw(0x45f820)asm

c:/go/src/pkg/runtime/panic.c:520 +0x71table

stackcacherefill()class

c:/go/src/pkg/runtime/stack.c:52 +0x87import

runtime.stackalloc(0x12219360, 0x4000)im

c:/go/src/pkg/runtime/stack.c:124 +0x154call

mstackalloc(0x11514000)error

c:/go/src/pkg/runtime/proc.c:1754 +0x43margin

runtime.mcall(0x423794)

c:/go/src/pkg/runtime/asm_386.s:190 +0x40

相關文章
相關標籤/搜索