Search code examples
javamavenintellij-ideajboss

Intellij occasionally unable to reserve enough space for object heap


RESOLVED check below for solution.

I'm using Intellij Idea 2017.2.2. Below is my intellij Specs.

My Intellij would only occasionally fail a maven build or a jboss server start with the error

Error occurred during initialization of VM
Could not reserve enough space for 1048576KB object heap

If I were to run the maven build with the vm args of

-Xms512m -Xmx1024m

The build would fail 9 out of 10 times (not exactly every 10th, but just randomly). But on the 10th time it would work. I simply have to keep pressing the install button until it works.

This was a major problem before was that if I don't specify the vm args then the build would go about halfway then fail on running out of java heap space.

The same exact behavior can be observed for my jboss server (JBOSS6.4 - 7.5.0.Final redhat 21), where the server would fail to start 9 out of 10 times. Then start up as randomly as it does not.

Specs

IntelliJ IDEA 2017.2.2

Build #IU-172.3757.52, built on August 14, 2017

Licensed to -----

Subscription is active until May 31, 2018

JRE: 1.8.0_152-release-915-b10 amd64

JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o

Windows 7 6.1

What I tested

I upgraded from Intellij 2017.1 to 2017.2 and the behavior did not change.

I also tried to do the same on Eclipse which also did not help.

Clean restart of PC, then close all the unnecessary apps, open intellij do a maven build and yet it fails, but a few more clicks and it works inconsistently as usual. (note at this moment only 6gb out of 16 is used, there is no way there is an insufficiency with memory)

*Edits

This PC have 16 gb of ram. While the fails are happening about 9.5GBs are being used at that moment.


Solution

  • Ultimately I was able to resolve the issue by updating the proper JDK. My project was picking up on an incorrect JDK and hence was running the 32 Bit as opposed to 64 bit JDK.

    Simply added the correct JDK under File > Project Settings.

    It seemed that my project never required that much memory before, but once the need had risen, it seems that a 64 bit became required.