• Register
Log In
0 votes

Problem :

I am having a box with 8gb of ram, so I don’t think the total memory is the issue. This application is running properly on boxes with 6gb or less ram.

What I am trying to do is to reserve 3GB of space using -Xmx3G command under "VM Arguments" in Run Configurations in my Eclipse.

But every time when I try to reserve more than 1500mb, I get following error: “Error occurred during initialization of VM; Could not reserve enough space for object heap” using -Xmx3G

Why am I getting such error any clue?

7.5k points

1 Answer

0 votes

Solution :

Please understand that Windows has virtual memory management and the JVM only needs the memory that is contiguous in its address space. So the other programs running on the system should not necessarily impact your heap size. What can affect you are DLL's those get loaded in to your address space. But the optimizations in Windows that minimizes the relocation of DLL's during the linking makes it more likely that you will have a fragmented address space. The things that are likely to cut in to your address space apart from the usual stuff includes the security softwares, CBT softwares, spywares and other forms of malwares. The likely causes of the variances are different security patches, C runtime versions, etc. The device drivers and other kernel bits have their own address space e.g. the other 2GB of the 4GB 32-bit space.

You could try going through your DLL bindings in your JVM process and try to rebase your DLL's in to the more compact address space. Alternatively, you can switch to the 64-bit Windows and a 64-bit JVM.

36.1k points

Related questions

1 vote
1 answer 14 views
Problem: I kept on getting this error when building for Android (shadow demo): Building DEX Failed! G:\Unity\JavaPluginSample\Temp/StagingArea> java -Xmx1024M -Djava.ext.dirs="G:/AndroidSDK/android-sdk_r09-windows\platform-tools/lib/" -jar "G:/AndroidSDK/android- ... initialization of VM Could not reserve enough space for object heap Could not create the Java virtual machine. How to solve this?
asked Mar 27 LizzyM 5.7k points
1 vote
1 answer 12 views
Problem: I am getting this error when I tried to build shadow demo for android: Building DEX Failed! G:\Unity\JavaPluginSample\Temp/StagingArea> java -Xmx1024M -Djava.ext.dirs="G:/AndroidSDK/android-sdk_r09-windows\platform-tools/lib/" -jar "G:/AndroidSDK/android- ... reserve enough space for object heap Could not create the Java virtual machine. Can anybody help to fix or explain me this error
asked Mar 24 LizzyM 5.7k points
1 vote
1 answer 18 views
Problem: I have been using java7 on my 32bit windows with 4 RAM and I am getting the messages below while using these codes java -Xmx4G -Xms4G -jar Minecraft.jar java -Xmx3G -Xms3G -jar Minecraft.jar java -Xmx2G -Xms2G -jar Minecraft.jar Error occurred ... Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. Why this is happening? Any solution?
asked Mar 6 Gavin 15.1k points
0 votes
1 answer 399 views
Problem : I had to run the jmap so that I can take the heap dump of my process. But the jvm returned below error : Unable to open socket file: target process not responding or HotSpot VM not loaded The -F option can be used when the target process is not responding So I ... to take the heap dump? 2. I am waiting for more than 20 minutes and not finished yet. Any ideas why it is taking so long?
asked Dec 19, 2019 alecxe 7.5k points
0 votes
1 answer 412 views
Problem : When I run the apache tomcat7.0.56 in Eclipse, I get below error Error: Could not find or load main class org.apache.catalina.startup.Bootstrap How can I fix the above problem?
asked Jan 18 jwilliam 3.9k points