To set the JVM heap size, compile the program normally.
For example, consider Runtime.java program.
For example, consider Runtime.java program.
Compilation: javac Runtime.javaNow, to set minimum heap size(let, 16 MB) required by JVM, run the program as follows :
java -Xms16m RuntimeWe can also restrict maximum size(let 512 MB) utilized by JVM:
java -Xmx512m RuntimeBoth these options can also be combined to specify upper and lower bounds of JVM heap size:
java -Xms16m -Xmx512m RuntimeNow you can run a program that requires huge computational space.
Comments
Post a Comment