We have Jenkins running on an ec2 instance. When doing a build, we see the following error:
17:29:39.149 [INFO] [org.gradle.api.Project] OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000007ac000000, 234881024, 0) failed; error='Cannot allocate memory' (errno=12)
17:29:39.150 [INFO] [org.gradle.api.Project] #
17:29:39.150 [INFO] [org.gradle.api.Project] # There is insufficient memory for the Java Runtime Environment to continue.
17:29:39.150 [INFO] [org.gradle.api.Project] # Native memory allocation (malloc) failed to allocate 234881024 bytes for committing reserved memory.
I researched on this topic and tried various settings such as increasing the heap memory, ram and PermGenSize. Here is my current memory setting on Jenkins:
-Xms256m -Xmx2048m -XX:MaxPermSize=512m
Are there any other things that I'm missing that's causing an OOM?
OutOfMemoryError: Heap space – this means that you need to increase the amount of heap space allocated to Jenkins when the daemon starts. java. lang. OutOfMemoryError: PermGen space – this means you need to increase the amount of generation space allocated to store Java object metadata.
Minimum hardware requirements: 256 MB of RAM. 1 GB of drive space (although 10 GB is a recommended minimum if running Jenkins as a Docker container)
I've sold the same problem. (I have ec2, t2.micro, Ubuntu 14, Jenkins, Tomcat, Maven). By default you don't have swap space. To confirm this:
free -m
Just add some. Try with 1 GB for begin.
sudo fallocate -l 1G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
Check again:
free -m
For more details look here
This is not a memory issue on JVM level, but on OS level. The JVM tries to allocate 224MB, but this amount of memory isn't available on OS level. This happens when the -Xmx settings of a JVM are larger than the amount of free memory in a system. Check the amount of free memory in the OS, and either limit the memory of your current JVM so that fits within the free memory, or try to free up memory (by limiting the amount of memory other processes use) or try out an EC2 instance with more memory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With