How to increase tons of space in Google Go
I am running Go code from the Rober Hundt benchmark to compare Go performance with other languages. When I run Go code from this test (see http://code.google.com/p/multi-language-bench/source/browse/trunk/src/#src%2Fhavlak%2Fgo ) I get out of memory exception :
................ runtime: out of memory: cannot allocate a block of 1048576 bytes (used 1270808576) throw: out of memory
My question is how can I increase the Go memory space. Is there some startup option or some flag for the compiler that can be set appropriately? Go source Makefile doesn't detect anything ...
Thanks, Oliver
source to share
If you share the OS version, if it is 32 vs 64 bit and your result go version
, we can probably help you more.
- The 32-bit version of Go is aware of heap memory issues and is not generally used in production. Make sure you are running 64-bit Go on a 64-bit platform.
- Go tip, the go branch that will become Go 1.1 has updated the maximum heap space from 8GB to 128GB . The main Go developers I've talked to recommend using the Go tip for memory intensive use.
- Switching to Windows is less used and therefore less tested, this could be a bug. Go is much more tested and believable on Linux and to a lesser extent OS X.
- As peterSO mentions, Robert Handt's criterion is wrong - read here: Go Profiling Programs
source to share
Robert Handt's test is wrong. This is not a real benchmark for Go. For more information, read "Profile Go Programs" .
source to share
For those who may be interested, I sent an email to mr. hundt itself asks if there is some (undocumented) compiler with which the heap size can be adapted or parameterized in some way. This was because I initially mistakenly assumed that such a switch should exist, but is not documented. And not a single hat responded to my post, it seems, too, knew. I guess I was "too inspired" here how jvm works ...
Anyway, he recommended trying different compilers (gcc-based compiler or plan-9-based compiler) as it might perform better than the other. Then try it on a 64-bit machine, of course.
He also pointed to my good article on Go memory management: http://lwn.net/Articles/428100/
But no, there is no compiler switch to play with memory settings.
Regards, Oliver
source to share