Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/link: linking github.com/hashicorp/packer takes >2gb of ram #32094
What version of Go are you using (
changed the title
Go compiler runs out of memory on t2.small when building packer
May 17, 2019
Thanks. And no worries about versions, whichever version makes sense. I was using the one users of FreeBSD are likely to use.
Note, I provided a simple terraform config to make it easier to reproduce. Finding the right FreeBSD AMI and navigating AWS if you don't know it is a pain. So the terraform config is just there to make it easier for you to get a test machine to try it on.
You can get the same outcome on a similarly sized non-AWS VM, I just happened to be setting up an AWS instance at the time. The base issue is memory usage in linking. The packer project seems to present an example body of code that takes what seems like an excessive amount of ram to link.
I think the changed title is a bit misleading because the issue really isn't with terraform. It's merely a convenience I provided to make people's lives easier in reproducing the issue. And I only included packer in the title because that's what I was compiling - I suspect packer is hardly the only code base where this issue occurs but I have not tried compiling a bunch of Go projects to prove that.
I tried doing
I'm going to tentatively mark this as 1.13, in case either of them sees something easy and safe to do here, inspired particularly by linking packer. It is highly likely this will get punted to 1.14, though.
Not really sure.