0

How can I change the default value of maximum Java heap size of all the programs running in Eclipse (ubuntu 18)?

(I mean without set the script argument for each entry point)

Also I'm not totally sure Runtime.getRuntime().maxMemory() give the real value..

I even add those line in eclipse.ini it seems ignored

-Xms256m
-Xmx4G

The proposed duplicate doesn't answer my question

alfredopacino
  • 2,979
  • 9
  • 42
  • 68

2 Answers2

1

You can set default arguments for a JVM used to run Java apps in the Preferences. Go to the 'Java > Installed JREs' page. Select the JRE/JDK you are using and click the 'Edit...' button. In the edit dialog there is a 'Default VM arguments' field where you can put your settings.

Note: The eclipse.ini lines only change the settings for Eclipse itself, they aren't relevant to running Java apps from Eclipse.

greg-449
  • 109,219
  • 232
  • 102
  • 145
  • thanks, there are no relation at all between Eclipse itself and Java applications? – alfredopacino Jan 31 '19 at 11:57
  • 1
    @alfredopacino None at all. The eclipse.ini settings only change settings for the JVM used to run Eclipse. JVMs used to run programs are completely separate and don't even have to be the same version of Java. – greg-449 Jan 31 '19 at 12:06
0

Following are the steps to increase JVM heap size in Eclipse:

Step 1

Open Eclipse and in the toolbar menu, go to Run -> Run Configurations

Step 2

In the left pane of Run Configurations window, navigate to the Java Application node and select the Java application for which you need to increase the heap size. Then in the right pane, click on the Arguments tab.

For example,

-Xms256M – JVM will start with an initial memory size of 256 MB
-Xmx512M – and can use up to a maximum of 512 MB .
Rmahajan
  • 1,311
  • 1
  • 14
  • 23
  • thanks, but those steps increase the memory for just a single application. The question was about how to increase the default value. – alfredopacino Jan 31 '19 at 00:21