-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/compile: 1.3MB program takes 290MB of memory to compile #1860
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I am starting having problems to compile go on a amd64 machine I don't use really often. $ uname -a Linux maison 3.7.1-2-ARCH #1 SMP PREEMPT Thu Dec 20 17:57:00 CET 2012 x86_64 GNU/Linux $ sysctl vm.overcommit_memory vm.overcommit_memory = 1 $ free -h total used free shared buffers cached Mem: 998M 675M 322M 0B 13M 88M -/+ buffers/cache: 573M 424M Swap: 0B 0B 0B $ cat /proc/cpuinfo [...] model name : Intel(R) Pentium(R) D CPU 2.80GHz [...] cpu MHz : 2792.945 [...] cpu cores : 2 [...] $ go install -a -v std [...] compress/lzw hash/adler32 compress/zlib container/list container/ring crypto/sha512 database/sql/driver database/sql debug/gosym encoding/ascii85 cmd/go expvar net/http/pprof cmd/godoc encoding/base32 go build encoding/base32: fork/exec /opt/remy/go/pkg/tool/linux_amd64/6g: cannot allocate memory encoding/csv go build encoding/csv: fork/exec /opt/remy/go/pkg/tool/linux_amd64/6g: cannot allocate memory exp/cookiejar go build exp/cookiejar: fork/exec /opt/remy/go/pkg/tool/linux_amd64/6g: cannot allocate memory exp/ebnf go build exp/ebnf: fork/exec /opt/remy/go/pkg/tool/linux_amd64/6g: cannot allocate memory exp/types go build exp/types: fork/exec /opt/remy/go/pkg/tool/linux_amd64/6g: cannot allocate memory exp/html/atom go build exp/html/atom: fork/exec /opt/remy/go/pkg/tool/linux_amd64/6g: cannot allocate memory [...] Restoring vm.overcommit_memory=1 solves the problem. The case described by this issue happens for real in the standard library now: $ ls -l src/pkg/exp/locale/collate total 2892 drwxr-xr-x 2 remy remy 4096 Dec 23 21:28 build -rw-r--r-- 1 remy remy 7284 Dec 23 21:28 colelem.go -rw-r--r-- 1 remy remy 4368 Dec 23 21:28 colelem_test.go -rw-r--r-- 1 remy remy 12571 Dec 23 21:28 collate.go -rw-r--r-- 1 remy remy 13089 Dec 23 21:28 collate_test.go -rw-r--r-- 1 remy remy 2392 Dec 23 21:28 contract.go -rw-r--r-- 1 remy remy 2291 Dec 23 21:28 contract_test.go -rw-r--r-- 1 remy remy 1112 Dec 23 21:28 export.go -rw-r--r-- 1 remy remy 1957 Dec 23 21:28 export_test.go -rw-r--r-- 1 remy remy 403 Dec 23 21:28 Makefile -rw-r--r-- 1 remy remy 17770 Dec 23 21:28 maketables.go -rw-r--r-- 1 remy remy 7009 Dec 23 21:28 regtest.go -rw-r--r-- 1 remy remy 3914 Dec 23 21:28 table.go -rw-r--r-- 1 remy remy 2828722 Dec 23 21:28 tables.go -rw-r--r-- 1 remy remy 8641 Dec 23 21:28 table_test.go drwxr-xr-x 3 remy remy 4096 Dec 23 21:28 tools -rw-r--r-- 1 remy remy 2264 Dec 23 21:28 trie.go -rw-r--r-- 1 remy remy 2596 Dec 23 21:28 trie_test.go |
This doesn't seem to be a problem. Computers are not in the days of 512mb RAM but 8gb RAM common place. |
A large multiplier in resource use when compiling is always a problem. |
On my system, cmd/compile appears to take about 106MB of memory to compile test/64bit.go's output now:
Do we have a particular goal in mind for when we can consider this issue fixed? For comparison, cmd/compile is taking less memory than gccgo does even without optimizations:
|
The text was updated successfully, but these errors were encountered: