Problems with java heap of space, how to increase heap size?

I am running a .bat file that points to asant:

C:\Sun\SDK\bin\asant Startbds 

asant again points to the xml file that I have, build.xml:

 <target name="Startbds" description="Start bds"> 

Now it was good, but now I have added more data, which leads to an error from memory:

 java.lang.outOfMemoryError: Java heap space 

So, I tried to increase the heap space by various methods that I found while searching for a solution:

  • cmd: set ANT_OPTS=-Xms512m -Xmx512m (does not work, same error message)
  • Editing asant.bat, where I edited the line "-set ANT_OPTS" from

.

 set ANT_OPTS="-Dos.name=Windows_NT" -Djava.library.path=%AS_INSTALL%\lib;%AS_ICU_LIB%;%AS_NSS%" "-Dcom.sun.aas.installRoot=%AS_INSTALL%" "-Dcom.sun.aas.instanceRoot=%AS_INSTALL%" "-Dcom.sun.aas.instanceName=server" "-Dcom.sun.aas.configRoot=%AS_CONFIG%" "-Dcom.sun.aas.processLauncher=SE" "-Dderby.root=%AS_DERBY_INSTALL%" 

TO

 set ANT_OPTS="-Xms512m -Xmx512m" "-Dos.name=Windows_NT" -Djava.library.path=%AS_INSTALL%\lib;%AS_ICU_LIB%;%AS_NSS%" "-Dcom.sun.aas.installRoot=%AS_INSTALL%" "-Dcom.sun.aas.instanceRoot=%AS_INSTALL%" "-Dcom.sun.aas.instanceName=server" "-Dcom.sun.aas.configRoot=%AS_CONFIG%" "-Dcom.sun.aas.processLauncher=SE" "-Dderby.root=%AS_DERBY_INSTALL%" 

but this gave me an error message:

 "Invalid initial heap size: -Xms512m -Xmx512m Could not create the Java virtual machine." 

Has anyone got an idea on how to increase yield? And perhaps also give a pointer to where I can find a tool to view the heap.

Thanks in advance.

+4
source share
3 answers

Using "-Xms512m -Xmx512m" , you specified one argument. -Xms expects the minimum heap size to be indicated by the rest of the argument. Thus, you have defined a minimum heap size of “512 m -Xmx512m,” which is not a valid value.

You must specify these keys as two arguments:

 set ANT_OPTS=-Xms512m -Xmx512m "-Dos.name=Windows_NT" ... 
+6
source

I think that if you are on Windows, you do not need double quotes in your set. Here is an example I saw somewhere:

 set ANT_OPTS=-Xms512m -Xmx512m (Windows) export ANT_OPTS="-Xms512m -Xmx512m" (ksh/bash) setenv ANT_OPTS "-Xms512m -Xmx512m" (tcsh/csh) 

Regarding heap usage control, if you are using the latest JDK for Windows, you should have Sun VisualVM.

+1
source

in eclipse-> window-> preferences-> Tomcat-> JVM Setting-> Append to JVM Parameters

-XX: MaxPermSize = 512m

-Xms512m

-Xmx512m

0
source

Source: https://habr.com/ru/post/1300756/


All Articles