1

About the following message:

Could not reserve enough space for 3145728KB object heap

I need some tips to understand what's going on

Points & Observations:

  • Running over Windows 10 x64 (16G Memory)
  • It only happens using this distribution: https://jdk.java.net/java-se-ri/8-MR3
  • It works fine using the build from AdoptOpenJDK: https://adoptopenjdk.net/?variant=openjdk8&jvmVariant=hotspot
  • At pom.xml, I've tried to add the following line: <extraJvmArgs>-Xms1G -Xmx4G -Xss1M -XX:-UseGCOverheadLimit -XX:MaxHeapSize=4G</extraJvmArgs>. But it "complains" The specified size exceeds the maximum representable size. (The original Xmx and MaxHeapSize was 3G)

Main Objective: To compile a project that was done previously using Oracle JDK8 with the Open JDK8

Any "lights"?

------ Edit

arg -d64 returns Error: This Java instance does not support a 64-bit JVM. Maybe it's 32 bits the compilation from Java website?

  • 5
    "Windows i586" is **32-bit**. _Any_ 32-bit program on Windows, even when _Windows_ is 64-bit, can only address about 3G, including Java. You can get both 32-bit and 64-bit builds for Windows (and Linux) under the _Oracle_ licensing (not GPL) including 8u40 or 8u45 if you have some reason for wanting that at https://www.oracle.com/java/technologies/oracle-java-archive-downloads.html – dave_thompson_085 Nov 12 '20 at 20:28
  • Have you read this? https://stackoverflow.com/questions/561245/virtual-memory-usage-from-java-under-linux-too-much-memory-used – Iman Nia Nov 12 '20 at 20:34
  • @lman I saw it. Not fixed my issue. – Helcio R. Macedo Pandelo Nov 12 '20 at 20:36
  • It is a 32 bit distribution but You should notice that not all of the memory you assign will be used by heap. The memory you assign will be divided into two parts, heap and non-heap (mostly readonly and they are jar files that you have loaded using class loader. This is one the biggest absurdity of Java. Please take a look at this blog, it is also usefull : https://spring.io/blog/2015/12/10/spring-boot-memory-performance – Iman Nia Nov 12 '20 at 20:37
  • @dave_thompson_085 yeah.. probably, but the idea is to run away from Oracle JDK to use the OpenJDK (because of the commercial license) – Helcio R. Macedo Pandelo Nov 12 '20 at 20:37
  • I know that link does not solve your problem but it gives some inside look about how java memory mgm works. Did you really declared a 3gb structure? (As a variable?) probably not. So those links may help. Sorry there is no simple remedy for this and it is highly dependant on your application. How you have modularized your project and how you have used load/unload. I can not even tell if manual GC will help you out of this. – Iman Nia Nov 12 '20 at 20:41
  • But one think for sure, the java on the machine you are running with -64 is a 32bit one. – Iman Nia Nov 12 '20 at 20:42
  • @HelcioR.MacedoPandelo I guess, what Dave is trying to say is, if you have compiled your project with a 32 bit java, it wouldn’t use 64 bit memory addressing even if your windows support it. I reckon you already know this. – Iman Nia Nov 12 '20 at 20:47
  • @Iman yeah.. got it, I wouldn't be able to use the one available at java.net website. I was trying it because it was required by our tech lead. I'll check another build – Helcio R. Macedo Pandelo Nov 12 '20 at 20:58

0 Answers0