码迷,mamicode.com
首页 > 其他好文 > 详细

golang 创建超过10万个Go程时报错stackcacherefill

时间:2014-09-25 12:21:09      阅读:264      评论:0      收藏:0      [点我收藏+]

标签:style   color   ar   for   sp   on   c   ef   r   

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)


runtime stack:

runtime.throw(0x45f820)

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

stackcacherefill()

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

runtime.stackalloc(0x12219360, 0x4000)

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

mstackalloc(0x11514000)

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

runtime.mcall(0x423794)

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


golang 创建超过10万个Go程时报错stackcacherefill

标签:style   color   ar   for   sp   on   c   ef   r   

原文地址:http://my.oschina.net/u/115763/blog/318386

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!