Difference between revisions of "Java memory allocation"
From MyWiki
(Created page with "<source lang="text"> The Java Virtual Machine takes two command line arguments which set the initial and maximum heap sizes: -Xms and -Xmx. You can add a system environment va...") |
|||
| (2 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
<source lang="text"> | <source lang="text"> | ||
| − | The Java Virtual Machine takes two command line arguments which set the initial and maximum heap sizes: -Xms and -Xmx. You can add a system environment variable named _JAVA_OPTIONS (under Windows), and set the heap size values there. | + | The Java Virtual Machine takes two command line arguments which set the initial and maximum heap sizes: -Xms and -Xmx. |
| + | You can add a system environment variable named _JAVA_OPTIONS (under Windows), and set the heap size values there. | ||
For example if you want a 512Mb initial and 1024Mb maximum heap size you could use: | For example if you want a 512Mb initial and 1024Mb maximum heap size you could use: | ||
SET _JAVA_OPTIONS = -Xms512m -Xmx1024m | SET _JAVA_OPTIONS = -Xms512m -Xmx1024m | ||
| + | |||
| + | =================================================== | ||
| + | It is possible to increase heap size allocated by the JVM by using command line options Here we have 3 options | ||
| + | |||
| + | -Xms<size> set initial Java heap size | ||
| + | -Xmx<size> set maximum Java heap size | ||
| + | -Xss<size> set java thread stack size | ||
| + | |||
| + | java -Xms16m -Xmx64m ClassName | ||
</source> | </source> | ||
Latest revision as of 09:46, 22 September 2014
The Java Virtual Machine takes two command line arguments which set the initial and maximum heap sizes: -Xms and -Xmx. You can add a system environment variable named _JAVA_OPTIONS (under Windows), and set the heap size values there. For example if you want a 512Mb initial and 1024Mb maximum heap size you could use: SET _JAVA_OPTIONS = -Xms512m -Xmx1024m =================================================== It is possible to increase heap size allocated by the JVM by using command line options Here we have 3 options -Xms<size> set initial Java heap size -Xmx<size> set maximum Java heap size -Xss<size> set java thread stack size java -Xms16m -Xmx64m ClassName