Why does an executable flask use a much larger bar when starting from the command line than the same project that starts from Eclipse?

Why does the executable jar use much more RAM when launched from the command line - in my case, about 7 times more than the same project launched from Eclipse?

When developing a project, I launch an application from Eclipse (Run-> Run), which uses about 60 MB (I watched the javaw.exe process just created), and if I create an executable JAR and run it from the line (Windows) command, using the plunger about 450 MB. In addition, the amplitude of the ram usage change is greater when launched from the command line than in Eclipse Run-> Run.

+6
source share
2 answers

This is probably due to the JVM settings with which Eclipse launches the application. When you run the Jar, Java will best guess which settings to use in memory. You can change the size of memory used with the java command on the console:

 java -Xms64m -Xmx256m -cp your.jar 

-Xms??m sets the minimum heap size in mb.
-Xmx??m sets the maximum heap size in mb.

Java probably automatically automatically selects the size of the large heap, as it is not dictated by eclipse.

+3
source

In eclipse, it should share ram with other services / application. But there are no restrictions on the command line. At the command line, you also have the opportunity to limit the bar by running the application. You can limit it by doing this.

 java -Xmx256M -Xms256M -cp /*.jar 
+2
source

All Articles