Go踩过的坑之make slice panic: runtime
作者:
五岁小孩 | 来源:发表于
2021-03-11 09:00 被阅读0次
Go踩过的坑之make slice panic: runtime error: makeslice: len out of range
重现
func main(){
var peek []byte
//var len=1000*1000*1000 //success
//var len=1000*1000*1000*1000// fatal error: out of memory allocating heap arena metadata
var len=1000*1000*1000*1000*1000 //panic: runtime error: makeslice: len out of range
//var len=-8//panic: runtime error: makeslice: len out of range
peek = append(peek, make([]byte, len)...)
fmt.Println("end......")
}
本文标题:Go踩过的坑之make slice panic: runtime
本文链接:https://www.haomeiwen.com/subject/inugxltx.html
网友评论