Mykhaylo Adamovych
Mykhaylo Adamovych

Reputation: 20966

Java application to use maximum available memory in the system

There are -Xmx and max-heap-size (jnlp) options to set maximum memory java application can use.
If these options are not specified application is permitted to use only small amount of available phisical memory in the system.
That is the reason people play with -Xmx to allow application to use more memory. But this is really a nightmare as for me because there could be different amont of memory on client machine and even OS should be taken into consideration.

Is there any way to alow java application to use maximum available memory in the system?

Thanks.

Upvotes: 5

Views: 739

Answers (2)

Steven Schlansker
Steven Schlansker

Reputation: 38526

Unfortunately, the best way I'm aware of is to write a simple launcher (possibly a shell script or batch file) that inspects the system, determines an appropriate value for -Xmx, and then launches the Java application. Once the JVM has initialized, it is not possible to change the values.

Upvotes: 3

Related Questions