-
Notifications
You must be signed in to change notification settings - Fork 17.5k
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: consumes 30GB memory #69054
Comments
CC @randall77 @golang/compiler |
Thanks for reporting. Are you able to also try with go1.23.0 and/or go1.22.6 and see if there's any noticeable difference? |
I tried 1.23.0 and it did not have a noticeable impact. |
Please let me know if there's additional data I can collect or anything I can provide to help diagnose root cause. This has become a priority issue for my team. Thanks! |
You're tracking Can you share your source code, or extract a reproducer? That would make it a whole lot easier to debug on our end. How much memory is your build system limiting the compile process to? When you say your "CI build failed", what does that mean, exactly? What process dies with what error? |
Our build system isn't limiting the memory allocated to the compile process. We are building on EC2 instances without swap space configured that have 32 GB memory. What is happening is that the kernel OOM killer is terminating the process when it is consuming too much memory. It takes on average 25 minutes for the compilation to reach that point before it is killed. I will work on extracting a reproducer for this and post something by the end of the week. Thanks! |
Go version
go version go1.21.7 linux/amd64
Output of
go env
in your module/workspace:What did you do?
We are using the gqlgen library to build a GraphQL service for our application. It generates a file that is 340K lines long (although I've tried refactoring the generated code to break it up into smaller files but this somewhat expectedly did not have any impact on the memory utilization). Compiling this file results in ~30GB memory being utilized which often results in our CI build failing and making it difficult for developers to build the code on their local machines.
What did you see happen?
The command used to compile the service is as follows:
I profiled the compilation via
go tool pprof -top -alloc_space /usr/local/go/pkg/tool/linux_amd64/compile memprofile.bin
and it outputted the following:What did you expect to see?
30GB seems excessive for the go compiler to require to build this source file. Please provide some guidance on how we can track down what is causing the high memory usage.
The text was updated successfully, but these errors were encountered: