Go运行时:在分配堆内存之前发生恐慌

huangapple go评论160阅读模式
英文:

Go runtime:panic before malloc heap initialized

问题

我正在使用 Windows 7 32 位企业版。当我在命令提示符中输入 "godoc" 时,它给出以下异常信息:

运行时错误:在分配堆空间之前发生 panic <br>
致命错误:运行时无法保留竞技场虚拟地址空间

Go 版本:go1.2rc5.windows-386.msi <br>
操作系统:Windows 7 企业版 32 位

英文:

I'm using windows 7 32 bit enterprise when i type godoc on cmd it gives me following exception:

runtime: panic before malloc heap initialized <br>
fatal error: runtime: cannot reverve arena virtual address space

GO version : go1.2rc5.windows-386.msi <br>
OS : Windows 7 enterprise 32 bit

答案1

得分: 3

请检查您是否有足够的空闲(物理)RAM,没有虚拟地址空间的限制,并尝试以管理员权限重新启动程序(有关UAC的报告可能会干扰)。如果这样做没有帮助,请报告一个问题。

错误的含义

致命错误:运行时无法保留竞技场虚拟地址空间

Go在虚拟地址空间中保留了一个内存区域。这个内存区域用于Go的内部内存分配,并提前保留,以便该区域是连续的。这个空间目前还没有在物理上(在RAM或磁盘上)使用。只有地址范围被保留。

由于运行时目前不处理内存限制,它总是尝试在32位机器上保留768MB的虚拟地址空间。

即使保留内存也是有代价的,您的操作系统(Windows)必须分配内存来保存分配信息,即虚拟地址描述符。如果您没有足够的内存来保存此描述符,保留将失败。另一方面,可能只是虚拟地址空间无法容纳768MB的连续空间而失败(例如由于碎片化)。

英文:

Check if you have enough free (physical) RAM, no virtual address space restrictions and
try restarting the program with administrator privileges (there are reports of UAC messing around). If that does not help, report an issue.

What the error means

> fatal error: runtime: cannot reverve arena virtual address space

Go reserves a memory region in virtual address space.
This memory region is used for Gos internal memory allocations and reserved in advance so
that the region is continuous. This space is not yet used physically (in RAM or disk).
Only the address range is reserved.

As the runtime currently does not handle memory limits it always attempts
to reserve 768MB of virtual address space on 32 bit machines.

Even reserving memory has a cost, your OS (windows) has to allocate memory to hold the
allocation information, a Virtual Address Descriptor.
If you haven't got enough memory to hold this descriptor the reservation will fail.
On the other hand, it may just be that the virtual address space can't hold 768MB of
continuous space and fails (for example due to fragmentation).

答案2

得分: 0

我从未将Windows用作开发站点,所以我只是在这里做出假设。

我猜测你的系统可能没有足够的可用内存来运行godoc,或者你以受限模式运行godoc,无法向内核请求内存分配。

无论如何,我认为错误消息中有趣的关键部分是“无法保留区域虚拟地址空间”,你可以在golang-nuts邮件列表上提出你的问题。

英文:

I never used windows as a development station, so I'm just make assumptions here.

I assume whether your system doesn't have enough disposable ram to run godoc, or you run godoc in a restricted mode unable to ask for memory allocation to the kernel.

Anyway I think the critical part of the interesting part of the error message is "cannot reverve arena virtual address space" and it would worth asking your question on the golang-nuts mailing list.

huangapple
  • 本文由 发表于 2013年11月27日 13:53:35
  • 转载请务必保留本文链接:https://go.coder-hub.com/20234919.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定