How do I increase RAM memory on Google Cloud Build?
I'm getting this error:
Step #1: FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
I'm using the REST API.
I'm trying to find the RAM memory config, but I only found a property called diskSizeInGb
.
The default for diskSizeInGb
is 100GB, and it's just a React app I'm compiling, so I don't think that's the case.
https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.builds#buildoptions
The RAM of the instance is dependant on the machine type you are using, if you need more RAM in your build, you will need to use a different value for machineType
.
By default, Cloud Build uses a "n1-standard-1" instance to run the build which has 3.75 GB of memory, however, you can change it to a "n1-highcpu-8" which has double that. You can find the information regarding the instance types over here.
Keep in mind that Cloud Build only accepts "n1-standard-1", "n1-highcpu-8" and "n1-highcpu-32" machines as mentioned in the documentation, and that each has a different billing.
Hope you find this useful!