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
cmd/compile: memory usage above 1.5 GB #33421
Comments
Can you find out what is being compiled when the compiler uses that much memory? |
You wrote that what you're doing is:
so I assume you're measuring the memory consumption of the old go1.4 toolchain while it builds the newest toolchain. That old 1.4 toolchain was written in C and it is kept around just for bootstrapping purposes, and it's basically frozen. It won't be optimized to make it faster or consume less memory. Your screenshot shows the process using 675M of Resident Memory (RES), which is what you care about, so the title of your issue doesn't match your report, as it doesn't appear the toolchain is using 1.7GB of memory. The newest compilers are written in Go and they also requires a fair amount of memory when bootstrapping master, anyway. You won't be able to compile the Go toolchain using 100 or 500 MB. AFAIK on 64-bit machines you'll need close to 800MB of memory per core. If you restrict make.bash to use one core, you should be able to build the latest toolchain using around 1GB of memory. |
@ianlancetaylor I took a snapshot of bootstrapping both go1.10.8 and go1.12.7, and the line with the highest CPU usage appeared when cmd/compile/internal/ssa was compiled:
I'm impressed that it apparently takes 33 seconds and 700 MB to build this single package (if I'm interpreting the numbers correctly). In a previous build I didn't have swap memory enabled, and the build failed even earlier (the process 6g was killed then). Indeed, this is still less than 1 GB, so I must have measured something else when I initially wrote this issue. Compared to go1.10.8, the largest process needed 27 MB more, which is a 4% increase. Since this is not much, it may have been pure coincidence that building go1.12 failed for me and building go1.10 had succeeded. Because of that difference I had opened this issue. I still think 700 MB is quite a lot of memory for building a single go package, but that's probably already mentioned in several other issues, making this one redundant. Therefore I'm closing it. |
Thanks for the info. CC'ing @randall77 as FYI, although the issue is now closed. |
Yes, |
What version of Go are you using (
go version
)?go 1.12.7 on NetBSD/amd64
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?What did you do?
bootstrap go1.12.7 using go14, via pkgsrc, the NetBSD package management framework
cd /usr/pkgsrc/lang/go112
bmake update
What did you expect to see?
Compiling go code takes less than 100 MB (ideally). 500 MB would already seem too high but still acceptable. But 1.7 GB is really too much.
What did you see instead?
The memory usage even went up to 1735 MB.
The text was updated successfully, but these errors were encountered: