Java programs executes in JVM uses Heap of memory to manage the data. If your Java program requires a large amount of memory, it is possible that the virtual machine will begin to throw OutOfMemoryError instances when attempting to instantiate an object. The default heap size if 1 MB and can increase as much as 16 MB.
Java heap space setting from command line:
Initial heap size 128m, max heap size 256m:
Initial heap size 256m, max heap size 256m:
Max heap size can't be less than initial heap size:
Java heap space setting from command line:
-
-Xmsfor initial heap size -
-Xmxfor maximum heap size -Xss<size>for set java stack size
Initial heap size 128m, max heap size 256m:
java -Xms128m -Xmx256m MyApp
Initial heap size 256m, max heap size 256m:
java -Xms128m -Xmx256m MyApp
Max heap size can't be less than initial heap size:
java -ms256m -mx128m MyAppError occurred during initialization of VM
Incompatible initial and maximum heap sizes specified
No comments:
Post a Comment