增加 Golang 1.4+ 的最大分配内存。

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

Increase Max Allocated Memory Golang 1.4+

问题

我正在考虑升级到Go 1.4,但我担心因为我不再知道如何更改我可以访问的最大内存量。

我一直在使用Go在一台大型服务器上运行一些机器学习实验,该服务器具有512GB的主内存,这使得使用37位地址设置的128GB限制不足够。

以前,我会编辑运行时包中的malloc.h文件以更改为38位地址,但是由于源代码从C转换为Go,我很难找到是否仍然有简单修改的方法。

这个提交将最大内存从16GB更改为128GB,显示了我所说的这种更改的类型。链接:https://code.google.com/p/go/source/detail?r=a310cb32c278

英文:

I'm thinking about upgrading to Go 1.4 but am concerned because I no longer know how to change the max amount of memory I can address.
I have been using Go to run some machine learning experiments on a large server, 512GB of main memory, which makes the 128GB limit set using a 37 bit address insufficient.

Previously I would edit malloc.h in the runtime package to change to 38 bit addresses but with the conversion from C to Go of the source I'm having difficulty finding if there is still something as simple to modify.

This commit that changed max memory to 128GB from 16GB shows the kind of change I am talking about https://code.google.com/p/go/source/detail?r=a310cb32c278

答案1

得分: 1

所以我意识到我没有找到这个文件,因为我不习惯使用Google Code仓库浏览器。我找到了现在有3个malloc.go文件,并找到了相关的代码部分。
https://code.google.com/p/go/source/browse/src/runtime/malloc2.go#122

老实说,我认为使用1和0布尔值以及乘法而不是简单的if语句来进行更新过于混乱,不像以前使用的头文件那样清晰地传达了正在发生的事情。

还有,谢谢bamboon,在阅读邮件列表并被链接到另一个仓库浏览器后,我才意识到我的错误。

英文:

So I realized I did not find the file because I am not use to using the Google Code repo explorer. I located what are now 3 malloc.go files and have found the relevant section of code.
https://code.google.com/p/go/source/browse/src/runtime/malloc2.go#122

Honestly I think the update using 1 and 0 booleans and multiplication rather than simple if statements is overly confusing and doesn't convey what is going on as clearly as the header file used to.

Also thank you bamboon I only realized my mistake after reading the mailing list and getting linked to a different repo viewer.

huangapple
  • 本文由 发表于 2015年1月31日 19:36:26
  • 转载请务必保留本文链接:https://go.coder-hub.com/28251148.html
匿名

发表评论

匿名网友

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

确定