dongxu1875 2013-08-31 14:40
浏览 115
已采纳

Golang:在malloc堆初始化之前出现恐慌

I run go build in the $GOPATH of my arch Vagrant box.
But it prints out

 runtime: panic before malloc heap initialized
 fatal error: runtime: cannot allocate heap metadata

And the box is 3.10.9-1-ARCH x86_64, memory 242M.

Why I can't build go files in the box?

Thanks in advance.

  • 写回答

1条回答 默认 最新

  • dongliqian6245 2013-08-31 22:34
    关注

    Looks like this is caused by not enough virtual memory

    $ ulimit -v 242000
    $ go build prog.go
    runtime: panic before malloc heap initialized
    fatal error: runtime: cannot allocate heap metadata
    

    64bit go needs lots of virtual memory space but not necessarily that much real memory.

    You could fix this by allocating more memory to the container.

    You could also play with the setting of /proc/sys/vm/overcommit_memory.

    You could also try allocating swap to the container (if possible).

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 很想要一个很好的答案或提示
  • ¥15 扫描项目中发现AndroidOS.Agent、Android/SmsThief.LI!tr
  • ¥15 怀疑手机被监控,请问怎么解决和防止
  • ¥15 Qt下使用tcp获取数据的详细操作
  • ¥15 idea右下角设置编码是灰色的
  • ¥15 全志H618ROM新增分区
  • ¥15 在grasshopper里DrawViewportWires更改预览后,禁用电池仍然显示
  • ¥15 NAO机器人的录音程序保存问题
  • ¥15 C#读写EXCEL文件,不同编译
  • ¥15 MapReduce结果输出到HBase,一直连接不上MySQL