Go踩过的坑之内存分配 fatal error: out of
作者:
五岁小孩 | 来源:发表于
2021-03-17 09:20 被阅读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踩过的坑之内存分配 fatal error: out of
本文链接:https://www.haomeiwen.com/subject/pnugxltx.html
网友评论