java.1 184 ko
Newer Older
Axel PERSEVALLE's avatar
Axel PERSEVALLE a validé
1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000
.B \f[CB]\-Xrs\f[R]
Reduces the use of operating system signals by the JVM.
Shutdown hooks enable the orderly shutdown of a Java application by
running user cleanup code (such as closing database connections) at
shutdown, even if the JVM terminates abruptly.
.RS
.IP \[bu] 2
\f[B]Linux and macOS:\f[R]
.RS 2
.IP \[bu] 2
The JVM catches signals to implement shutdown hooks for unexpected
termination.
The JVM uses \f[CB]SIGHUP\f[R], \f[CB]SIGINT\f[R], and \f[CB]SIGTERM\f[R] to
initiate the running of shutdown hooks.
.IP \[bu] 2
Applications embedding the JVM frequently need to trap signals such as
\f[CB]SIGINT\f[R] or \f[CB]SIGTERM\f[R], which can lead to interference with
the JVM signal handlers.
The \f[CB]\-Xrs\f[R] option is available to address this issue.
When \f[CB]\-Xrs\f[R] is used, the signal masks for \f[CB]SIGINT\f[R],
\f[CB]SIGTERM\f[R], \f[CB]SIGHUP\f[R], and \f[CB]SIGQUIT\f[R] aren\[aq]t
changed by the JVM, and signal handlers for these signals aren\[aq]t
installed.
.RE
.IP \[bu] 2
\f[B]Windows:\f[R]
.RS 2
.IP \[bu] 2
The JVM watches for console control events to implement shutdown hooks
for unexpected termination.
Specifically, the JVM registers a console control handler that begins
shutdown\-hook processing and returns \f[CB]TRUE\f[R] for
\f[CB]CTRL_C_EVENT\f[R], \f[CB]CTRL_CLOSE_EVENT\f[R],
\f[CB]CTRL_LOGOFF_EVENT\f[R], and \f[CB]CTRL_SHUTDOWN_EVENT\f[R].
.IP \[bu] 2
The JVM uses a similar mechanism to implement the feature of dumping
thread stacks for debugging purposes.
The JVM uses \f[CB]CTRL_BREAK_EVENT\f[R] to perform thread dumps.
.IP \[bu] 2
If the JVM is run as a service (for example, as a servlet engine for a
web server), then it can receive \f[CB]CTRL_LOGOFF_EVENT\f[R] but
shouldn\[aq]t initiate shutdown because the operating system doesn\[aq]t
actually terminate the process.
To avoid possible interference such as this, the \f[CB]\-Xrs\f[R] option
can be used.
When the \f[CB]\-Xrs\f[R] option is used, the JVM doesn\[aq]t install a
console control handler, implying that it doesn\[aq]t watch for or
process \f[CB]CTRL_C_EVENT\f[R], \f[CB]CTRL_CLOSE_EVENT\f[R],
\f[CB]CTRL_LOGOFF_EVENT\f[R], or \f[CB]CTRL_SHUTDOWN_EVENT\f[R].
.RE
.PP
There are two consequences of specifying \f[CB]\-Xrs\f[R]:
.IP \[bu] 2
\f[B]Linux and macOS:\f[R] \f[CB]SIGQUIT\f[R] thread dumps aren\[aq]t
available.
.IP \[bu] 2
\f[B]Windows:\f[R] Ctrl + Break thread dumps aren\[aq]t available.
.PP
User code is responsible for causing shutdown hooks to run, for example,
by calling the \f[CB]System.exit()\f[R] when the JVM is to be terminated.
.RE
.TP
.B \f[CB]\-Xshare:\f[R]\f[I]mode\f[R]
Sets the class data sharing (CDS) mode.
.RS
.PP
Possible \f[I]mode\f[R] arguments for this option include the following:
.TP
.B \f[CB]auto\f[R]
Use shared class data if possible (default).
.RS
.RE
.TP
.B \f[CB]on\f[R]
Require using shared class data, otherwise fail.
.RS
.RE
.RS
.PP
\f[B]Note:\f[R] The \f[CB]\-Xshare:on\f[R] option is used for testing
purposes only.
It may cause the VM to unexpectedly exit during start\-up when the CDS
archive cannot be used (for example, when certain VM parameters are
changed, or when a different JDK is used).
This option should not be used in production environments.
.RE
.TP
.B \f[CB]off\f[R]
Do not attempt to use shared class data.
.RS
.RE
.RE
.TP
.B \f[CB]\-XshowSettings\f[R]
Shows all settings and then continues.
.RS
.RE
.TP
.B \f[CB]\-XshowSettings:\f[R]\f[I]category\f[R]
Shows settings and continues.
Possible \f[I]category\f[R] arguments for this option include the
following:
.RS
.TP
.B \f[CB]all\f[R]
Shows all categories of settings.
This is the default value.
.RS
.RE
.TP
.B \f[CB]locale\f[R]
Shows settings related to locale.
.RS
.RE
.TP
.B \f[CB]properties\f[R]
Shows settings related to system properties.
.RS
.RE
.TP
.B \f[CB]vm\f[R]
Shows the settings of the JVM.
.RS
.RE
.TP
.B \f[CB]system\f[R]
\f[B]Linux:\f[R] Shows host system or container configuration and
continues.
.RS
.RE
.RE
.TP
.B \f[CB]\-Xss\f[R] \f[I]size\f[R]
Sets the thread stack size (in bytes).
Append the letter \f[CB]k\f[R] or \f[CB]K\f[R] to indicate KB, \f[CB]m\f[R] or
\f[CB]M\f[R] to indicate MB, or \f[CB]g\f[R] or \f[CB]G\f[R] to indicate GB.
The default value depends on the platform:
.RS
.IP \[bu] 2
Linux/x64 (64\-bit): 1024 KB
.IP \[bu] 2
macOS (64\-bit): 1024 KB
.IP \[bu] 2
Windows: The default value depends on virtual memory
.PP
The following examples set the thread stack size to 1024 KB in different
units:
.IP
.nf
\f[CB]
\-Xss1m
\-Xss1024k
\-Xss1048576
\f[R]
.fi
.PP
This option is similar to \f[CB]\-XX:ThreadStackSize\f[R].
.RE
.TP
.B \f[CB]\-\-add\-reads\f[R] \f[I]module\f[R]\f[CB]=\f[R]\f[I]target\-module\f[R](\f[CB],\f[R]\f[I]target\-module\f[R])*
Updates \f[I]module\f[R] to read the \f[I]target\-module\f[R], regardless
of the module declaration.
\f[I]target\-module\f[R] can be all unnamed to read all unnamed modules.
.RS
.RE
.TP
.B \f[CB]\-\-add\-exports\f[R] \f[I]module\f[R]\f[CB]/\f[R]\f[I]package\f[R]\f[CB]=\f[R]\f[I]target\-module\f[R](\f[CB],\f[R]\f[I]target\-module\f[R])*
Updates \f[I]module\f[R] to export \f[I]package\f[R] to
\f[I]target\-module\f[R], regardless of module declaration.
The \f[I]target\-module\f[R] can be all unnamed to export to all unnamed
modules.
.RS
.RE
.TP
.B \f[CB]\-\-add\-opens\f[R] \f[I]module\f[R]\f[CB]/\f[R]\f[I]package\f[R]\f[CB]=\f[R]\f[I]target\-module\f[R](\f[CB],\f[R]\f[I]target\-module\f[R])*
Updates \f[I]module\f[R] to open \f[I]package\f[R] to
\f[I]target\-module\f[R], regardless of module declaration.
.RS
.RE
.TP
.B \f[CB]\-\-limit\-modules\f[R] \f[I]module\f[R][\f[CB],\f[R]\f[I]module\f[R]...]
Specifies the limit of the universe of observable modules.
.RS
.RE
.TP
.B \f[CB]\-\-patch\-module\f[R] \f[I]module\f[R]\f[CB]=\f[R]\f[I]file\f[R](\f[CB];\f[R]\f[I]file\f[R])*
Overrides or augments a module with classes and resources in JAR files
or directories.
.RS
.RE
.TP
.B \f[CB]\-\-source\f[R] \f[I]version\f[R]
Sets the version of the source in source\-file mode.
.RS
.RE
.SH EXTRA OPTIONS FOR MACOS
.PP
The following extra options are macOS specific.
.TP
.B \f[CB]\-XstartOnFirstThread\f[R]
Runs the \f[CB]main()\f[R] method on the first (AppKit) thread.
.RS
.RE
.TP
.B \f[CB]\-Xdock:name=\f[R]\f[I]application_name\f[R]
Overrides the default application name displayed in dock.
.RS
.RE
.TP
.B \f[CB]\-Xdock:icon=\f[R]\f[I]path_to_icon_file\f[R]
Overrides the default icon displayed in dock.
.RS
.RE
.SH ADVANCED OPTIONS FOR JAVA
.PP
These \f[CB]java\f[R] options can be used to enable other advanced
options.
.TP
.B \f[CB]\-XX:+UnlockDiagnosticVMOptions\f[R]
Unlocks the options intended for diagnosing the JVM.
By default, this option is disabled and diagnostic options aren\[aq]t
available.
.RS
.PP
Command line options that are enabled with the use of this option are
not supported.
If you encounter issues while using any of these options, it is very
likely that you will be required to reproduce the problem without using
any of these unsupported options before Oracle Support can assist with
an investigation.
It is also possible that any of these options may be removed or their
behavior changed without any warning.
.RE
.TP
.B \f[CB]\-XX:+UnlockExperimentalVMOptions\f[R]
Unlocks the options that provide experimental features in the JVM.
By default, this option is disabled and experimental features aren\[aq]t
available.
.RS
.RE
.SH ADVANCED RUNTIME OPTIONS FOR JAVA
.PP
These \f[CB]java\f[R] options control the runtime behavior of the Java
HotSpot VM.
.TP
.B \f[CB]\-XX:ActiveProcessorCount=\f[R]\f[I]x\f[R]
Overrides the number of CPUs that the VM will use to calculate the size
of thread pools it will use for various operations such as Garbage
Collection and ForkJoinPool.
.RS
.PP
The VM normally determines the number of available processors from the
operating system.
This flag can be useful for partitioning CPU resources when running
multiple Java processes in docker containers.
This flag is honored even if \f[CB]UseContainerSupport\f[R] is not
enabled.
See \f[CB]\-XX:\-UseContainerSupport\f[R] for a description of enabling
and disabling container support.
.RE
.TP
.B \f[CB]\-XX:AllocateHeapAt=\f[R]\f[I]path\f[R]
Takes a path to the file system and uses memory mapping to allocate the
object heap on the memory device.
Using this option enables the HotSpot VM to allocate the Java object
heap on an alternative memory device, such as an NV\-DIMM, specified by
the user.
.RS
.PP
Alternative memory devices that have the same semantics as DRAM,
including the semantics of atomic operations, can be used instead of
DRAM for the object heap without changing the existing application code.
All other memory structures (such as the code heap, metaspace, and
thread stacks) continue to reside in DRAM.
.PP
Some operating systems expose non\-DRAM memory through the file system.
Memory\-mapped files in these file systems bypass the page cache and
provide a direct mapping of virtual memory to the physical memory on the
device.
The existing heap related flags (such as \f[CB]\-Xmx\f[R] and
\f[CB]\-Xms\f[R]) and garbage\-collection related flags continue to work
as before.
.RE
.TP
.B \f[CB]\-XX:\-CompactStrings\f[R]
Disables the Compact Strings feature.
By default, this option is enabled.
When this option is enabled, Java Strings containing only single\-byte
characters are internally represented and stored as
single\-byte\-per\-character Strings using ISO\-8859\-1 / Latin\-1
encoding.
This reduces, by 50%, the amount of space required for Strings
containing only single\-byte characters.
For Java Strings containing at least one multibyte character: these are
represented and stored as 2 bytes per character using UTF\-16 encoding.
Disabling the Compact Strings feature forces the use of UTF\-16 encoding
as the internal representation for all Java Strings.
.RS
.PP
Cases where it may be beneficial to disable Compact Strings include the
following:
.IP \[bu] 2
When it\[aq]s known that an application overwhelmingly will be
allocating multibyte character Strings
.IP \[bu] 2
In the unexpected event where a performance regression is observed in
migrating from Java SE 8 to Java SE 9 and an analysis shows that Compact
Strings introduces the regression
.PP
In both of these scenarios, disabling Compact Strings makes sense.
.RE
.TP
.B \f[CB]\-XX:ErrorFile=\f[R]\f[I]filename\f[R]
Specifies the path and file name to which error data is written when an
irrecoverable error occurs.
By default, this file is created in the current working directory and
named \f[CB]hs_err_pid\f[R]\f[I]pid\f[R]\f[CB]\&.log\f[R] where \f[I]pid\f[R]
is the identifier of the process that encountered the error.
.RS
.PP
The following example shows how to set the default log file (note that
the identifier of the process is specified as \f[CB]%p\f[R]):
.RS
.PP
\f[CB]\-XX:ErrorFile=./hs_err_pid%p.log\f[R]
.RE
.IP \[bu] 2
\f[B]Linux and macOS:\f[R] The following example shows how to set the
error log to \f[CB]/var/log/java/java_error.log\f[R]:
.RS 2
.RS
.PP
\f[CB]\-XX:ErrorFile=/var/log/java/java_error.log\f[R]
.RE
.RE
.IP \[bu] 2
\f[B]Windows:\f[R] The following example shows how to set the error log
file to \f[CB]C:/log/java/java_error.log\f[R]:
.RS 2
.RS
.PP
\f[CB]\-XX:ErrorFile=C:/log/java/java_error.log\f[R]
.RE
.RE
.PP
If the file exists, and is writeable, then it will be overwritten.
Otherwise, if the file can\[aq]t be created in the specified directory
(due to insufficient space, permission problem, or another issue), then
the file is created in the temporary directory for the operating system:
.IP \[bu] 2
\f[B]Linux and macOS:\f[R] The temporary directory is \f[CB]/tmp\f[R].
.IP \[bu] 2
\f[B]Windows:\f[R] The temporary directory is specified by the value of
the \f[CB]TMP\f[R] environment variable; if that environment variable
isn\[aq]t defined, then the value of the \f[CB]TEMP\f[R] environment
variable is used.
.RE
.TP
.B \f[CB]\-XX:+ExtensiveErrorReports\f[R]
Enables the reporting of more extensive error information in the
\f[CB]ErrorFile\f[R].
This option can be turned on in environments where maximal information
is desired \- even if the resulting logs may be quite large and/or
contain information that might be considered sensitive.
The information can vary from release to release, and across different
platforms.
By default this option is disabled.
.RS
.RE
.TP
.B \f[CB]\-XX:FlightRecorderOptions=\f[R]\f[I]parameter\f[R]\f[CB]=\f[R]\f[I]value\f[R] (or)\f[CB]\-XX:FlightRecorderOptions:\f[R]\f[I]parameter\f[R]\f[CB]=\f[R]\f[I]value\f[R]
Sets the parameters that control the behavior of JFR.
.RS
.PP
The following list contains the available JFR
\f[I]parameter\f[R]\f[CB]=\f[R]\f[I]value\f[R] entries:
.TP
.B \f[CB]globalbuffersize=\f[R]\f[I]size\f[R]
Specifies the total amount of primary memory used for data retention.
The default value is based on the value specified for
\f[CB]memorysize\f[R].
Change the \f[CB]memorysize\f[R] parameter to alter the size of global
buffers.
.RS
.RE
.TP
.B \f[CB]maxchunksize=\f[R]\f[I]size\f[R]
Specifies the maximum size (in bytes) of the data chunks in a recording.
Append \f[CB]m\f[R] or \f[CB]M\f[R] to specify the size in megabytes (MB),
or \f[CB]g\f[R] or \f[CB]G\f[R] to specify the size in gigabytes (GB).
By default, the maximum size of data chunks is set to 12 MB.
The minimum allowed is 1 MB.
.RS
.RE
.TP
.B \f[CB]memorysize=\f[R]\f[I]size\f[R]
Determines how much buffer memory should be used, and sets the
\f[CB]globalbuffersize\f[R] and \f[CB]numglobalbuffers\f[R] parameters based
on the size specified.
Append \f[CB]m\f[R] or \f[CB]M\f[R] to specify the size in megabytes (MB),
or \f[CB]g\f[R] or \f[CB]G\f[R] to specify the size in gigabytes (GB).
By default, the memory size is set to 10 MB.
.RS
.RE
.TP
.B \f[CB]numglobalbuffers\f[R]
Specifies the number of global buffers used.
The default value is based on the memory size specified.
Change the \f[CB]memorysize\f[R] parameter to alter the number of global
buffers.
.RS
.RE
.TP
.B \f[CB]old\-object\-queue\-size=number\-of\-objects\f[R]
Maximum number of old objects to track.
By default, the number of objects is set to 256.
.RS
.RE
.TP
.B \f[CB]repository=\f[R]\f[I]path\f[R]
Specifies the repository (a directory) for temporary disk storage.
By default, the system\[aq]s temporary directory is used.
.RS
.RE
.TP
.B \f[CB]retransform=\f[R]{\f[CB]true\f[R]|\f[CB]false\f[R]}
Specifies whether event classes should be retransformed using JVMTI.
If false, instrumentation is added when event classes are loaded.
By default, this parameter is enabled.
.RS
.RE
.TP
.B \f[CB]samplethreads=\f[R]{\f[CB]true\f[R]|\f[CB]false\f[R]}
Specifies whether thread sampling is enabled.
Thread sampling occurs only if the sampling event is enabled along with
this parameter.
By default, this parameter is enabled.
.RS
.RE
.TP
.B \f[CB]stackdepth=\f[R]\f[I]depth\f[R]
Stack depth for stack traces.
By default, the depth is set to 64 method calls.
The maximum is 2048.
Values greater than 64 could create significant overhead and reduce
performance.
.RS
.RE
.TP
.B \f[CB]threadbuffersize=\f[R]\f[I]size\f[R]
Specifies the per\-thread local buffer size (in bytes).
By default, the local buffer size is set to 8 kilobytes, with a minimum
value of 4 kilobytes.
Overriding this parameter could reduce performance and is not
recommended.
.RS
.RE
.PP
You can specify values for multiple parameters by separating them with a
comma.
.RE
.TP
.B \f[CB]\-XX:LargePageSizeInBytes=\f[R]\f[I]size\f[R]
Sets the maximum large page size (in bytes) used by the JVM.
The \f[I]size\f[R] argument must be a valid page size supported by the
environment to have any effect.
Append the letter \f[CB]k\f[R] or \f[CB]K\f[R] to indicate kilobytes,
\f[CB]m\f[R] or \f[CB]M\f[R] to indicate megabytes, or \f[CB]g\f[R] or
\f[CB]G\f[R] to indicate gigabytes.
By default, the size is set to 0, meaning that the JVM will use the
default large page size for the environment as the maximum size for
large pages.
See \f[B]Large Pages\f[R].
.RS
.PP
The following example describes how to set the large page size to 1
gigabyte (GB):
.RS
.PP
\f[CB]\-XX:LargePageSizeInBytes=1g\f[R]
.RE
.RE
.TP
.B \f[CB]\-XX:MaxDirectMemorySize=\f[R]\f[I]size\f[R]
Sets the maximum total size (in bytes) of the \f[CB]java.nio\f[R] package,
direct\-buffer allocations.
Append the letter \f[CB]k\f[R] or \f[CB]K\f[R] to indicate kilobytes,
\f[CB]m\f[R] or \f[CB]M\f[R] to indicate megabytes, or \f[CB]g\f[R] or
\f[CB]G\f[R] to indicate gigabytes.
By default, the size is set to 0, meaning that the JVM chooses the size
for NIO direct\-buffer allocations automatically.
.RS
.PP
The following examples illustrate how to set the NIO size to 1024 KB in
different units:
.IP
.nf
\f[CB]
\-XX:MaxDirectMemorySize=1m
\-XX:MaxDirectMemorySize=1024k
\-XX:MaxDirectMemorySize=1048576
\f[R]
.fi
.RE
.TP
.B \f[CB]\-XX:\-MaxFDLimit\f[R]
Disables the attempt to set the soft limit for the number of open file
descriptors to the hard limit.
By default, this option is enabled on all platforms, but is ignored on
Windows.
The only time that you may need to disable this is on Mac OS, where its
use imposes a maximum of 10240, which is lower than the actual system
maximum.
.RS
.RE
.TP
.B \f[CB]\-XX:NativeMemoryTracking=\f[R]\f[I]mode\f[R]
Specifies the mode for tracking JVM native memory usage.
Possible \f[I]mode\f[R] arguments for this option include the following:
.RS
.TP
.B \f[CB]off\f[R]
Instructs not to track JVM native memory usage.
This is the default behavior if you don\[aq]t specify the
\f[CB]\-XX:NativeMemoryTracking\f[R] option.
.RS
.RE
.TP
.B \f[CB]summary\f[R]
Tracks memory usage only by JVM subsystems, such as Java heap, class,
code, and thread.
.RS
.RE
.TP
.B \f[CB]detail\f[R]
In addition to tracking memory usage by JVM subsystems, track memory
usage by individual \f[CB]CallSite\f[R], individual virtual memory region
and its committed regions.
.RS
.RE
.RE
.TP
.B \f[CB]\-XX:ObjectAlignmentInBytes=\f[R]\f[I]alignment\f[R]
Sets the memory alignment of Java objects (in bytes).
By default, the value is set to 8 bytes.
The specified value should be a power of 2, and must be within the range
of 8 and 256 (inclusive).
This option makes it possible to use compressed pointers with large Java
heap sizes.
.RS
.PP
The heap size limit in bytes is calculated as:
.RS
.PP
\f[CB]4GB\ *\ ObjectAlignmentInBytes\f[R]
.RE
.RS
.PP
\f[B]Note:\f[R] As the alignment value increases, the unused space
between objects also increases.
As a result, you may not realize any benefits from using compressed
pointers with large Java heap sizes.
.RE
.RE
.TP
.B \f[CB]\-XX:OnError=\f[R]\f[I]string\f[R]
Sets a custom command or a series of semicolon\-separated commands to
run when an irrecoverable error occurs.
If the string contains spaces, then it must be enclosed in quotation
marks.
.RS
.IP \[bu] 2
\f[B]Linux and macOS:\f[R] The following example shows how the
\f[CB]\-XX:OnError\f[R] option can be used to run the \f[CB]gcore\f[R]
command to create a core image, and start the \f[CB]gdb\f[R] debugger to
attach to the process in case of an irrecoverable error (the \f[CB]%p\f[R]
designates the current process identifier):
.RS 2
.RS
.PP
\f[CB]\-XX:OnError="gcore\ %p;gdb\ \-p\ %p"\f[R]
.RE
.RE
.IP \[bu] 2
\f[B]Windows:\f[R] The following example shows how the
\f[CB]\-XX:OnError\f[R] option can be used to run the
\f[CB]userdump.exe\f[R] utility to obtain a crash dump in case of an
irrecoverable error (the \f[CB]%p\f[R] designates the current process
identifier).
This example assumes that the path to the \f[CB]userdump.exe\f[R] utility
is specified in the \f[CB]PATH\f[R] environment variable:
.RS 2
.RS
.PP
\f[CB]\-XX:OnError="userdump.exe\ %p"\f[R]
.RE
.RE
.RE
.TP
.B \f[CB]\-XX:OnOutOfMemoryError=\f[R]\f[I]string\f[R]
Sets a custom command or a series of semicolon\-separated commands to
run when an \f[CB]OutOfMemoryError\f[R] exception is first thrown.
If the string contains spaces, then it must be enclosed in quotation
marks.
For an example of a command string, see the description of the
\f[CB]\-XX:OnError\f[R] option.
.RS
.RE
.TP
.B \f[CB]\-XX:+PrintCommandLineFlags\f[R]
Enables printing of ergonomically selected JVM flags that appeared on
the command line.
It can be useful to know the ergonomic values set by the JVM, such as
the heap space size and the selected garbage collector.
By default, this option is disabled and flags aren\[aq]t printed.
.RS
.RE
.TP
.B \f[CB]\-XX:+PreserveFramePointer\f[R]
Selects between using the RBP register as a general purpose register
(\f[CB]\-XX:\-PreserveFramePointer\f[R]) and using the RBP register to
hold the frame pointer of the currently executing method
(\f[CB]\-XX:+PreserveFramePointer\f[R] .
If the frame pointer is available, then external profiling tools (for
example, Linux perf) can construct more accurate stack traces.
.RS
.RE
.TP
.B \f[CB]\-XX:+PrintNMTStatistics\f[R]
Enables printing of collected native memory tracking data at JVM exit
when native memory tracking is enabled (see
\f[CB]\-XX:NativeMemoryTracking\f[R]).
By default, this option is disabled and native memory tracking data
isn\[aq]t printed.
.RS
.RE
.TP
.B \f[CB]\-XX:SharedArchiveFile=\f[R]\f[I]path\f[R]
Specifies the path and name of the class data sharing (CDS) archive file
.RS
.PP
See \f[B]Application Class Data Sharing\f[R].
.RE
.TP
.B \f[CB]\-XX:SharedArchiveConfigFile\f[R]=\f[I]shared_config_file\f[R]
Specifies additional shared data added to the archive file.
.RS
.RE
.TP
.B \f[CB]\-XX:SharedClassListFile=\f[R]\f[I]file_name\f[R]
Specifies the text file that contains the names of the classes to store
in the class data sharing (CDS) archive.
This file contains the full name of one class per line, except slashes
(\f[CB]/\f[R]) replace dots (\f[CB]\&.\f[R]).
For example, to specify the classes \f[CB]java.lang.Object\f[R] and
\f[CB]hello.Main\f[R], create a text file that contains the following two
lines:
.RS
.IP
.nf
\f[CB]
java/lang/Object
hello/Main
\f[R]
.fi
.PP
The classes that you specify in this text file should include the
classes that are commonly used by the application.
They may include any classes from the application, extension, or
bootstrap class paths.
.PP
See \f[B]Application Class Data Sharing\f[R].
.RE
.TP
.B \f[CB]\-XX:+ShowCodeDetailsInExceptionMessages\f[R]
Enables printing of improved \f[CB]NullPointerException\f[R] messages.
When an application throws a \f[CB]NullPointerException\f[R], the option
enables the JVM to analyze the program\[aq]s bytecode instructions to
determine precisely which reference is \f[CB]null\f[R], and describes the
source with a null\-detail message.
The null\-detail message is calculated and returned by
\f[CB]NullPointerException.getMessage()\f[R], and will be printed as the
exception message along with the method, filename, and line number.
By default, this option is enabled.
.RS
.RE
.TP
.B \f[CB]\-XX:+ShowMessageBoxOnError\f[R]
Enables the display of a dialog box when the JVM experiences an
irrecoverable error.
This prevents the JVM from exiting and keeps the process active so that
you can attach a debugger to it to investigate the cause of the error.
By default, this option is disabled.
.RS
.RE
.TP
.B \f[CB]\-XX:StartFlightRecording=\f[R]\f[I]parameter\f[R]\f[CB]=\f[R]\f[I]value\f[R]
Starts a JFR recording for the Java application.
This option is equivalent to the \f[CB]JFR.start\f[R] diagnostic command
that starts a recording during runtime.
You can set the following \f[I]parameter\f[R]\f[CB]=\f[R]\f[I]value\f[R]
entries when starting a JFR recording:
.RS
.TP
.B \f[CB]delay=\f[R]\f[I]time\f[R]
Specifies the delay between the Java application launch time and the
start of the recording.
Append \f[CB]s\f[R] to specify the time in seconds, \f[CB]m\f[R] for
minutes, \f[CB]h\f[R] for hours, or \f[CB]d\f[R] for days (for example,
specifying \f[CB]10m\f[R] means 10 minutes).
By default, there\[aq]s no delay, and this parameter is set to 0.
.RS
.RE
.TP
.B \f[CB]disk=\f[R]{\f[CB]true\f[R]|\f[CB]false\f[R]}
Specifies whether to write data to disk while recording.
By default, this parameter is enabled.
.RS
.RE
.TP
.B \f[CB]dumponexit=\f[R]{\f[CB]true\f[R]|\f[CB]false\f[R]}
Specifies if the running recording is dumped when the JVM shuts down.
If enabled and a \f[CB]filename\f[R] is not entered, the recording is
written to a file in the directory where the process was started.
The file name is a system\-generated name that contains the process ID,
recording ID, and current timestamp, similar to
\f[CB]hotspot\-pid\-47496\-id\-1\-2018_01_25_19_10_41.jfr\f[R].
By default, this parameter is disabled.
.RS
.RE
.TP
.B \f[CB]duration=\f[R]\f[I]time\f[R]
Specifies the duration of the recording.
Append \f[CB]s\f[R] to specify the time in seconds, \f[CB]m\f[R] for
minutes, \f[CB]h\f[R] for hours, or \f[CB]d\f[R] for days (for example,
specifying \f[CB]5h\f[R] means 5 hours).
By default, the duration isn\[aq]t limited, and this parameter is set to
0.
.RS
.RE
.TP
.B \f[CB]filename=\f[R]\f[I]path\f[R]
Specifies the path and name of the file to which the recording is
written when the recording is stopped, for example:
.RS
.IP \[bu] 2
\f[CB]recording.jfr\f[R]
.IP \[bu] 2
\f[CB]/home/user/recordings/recording.jfr\f[R]
.IP \[bu] 2
\f[CB]c:\\recordings\\recording.jfr\f[R]
.RE
.TP
.B \f[CB]name=\f[R]\f[I]identifier\f[R]
Takes both the name and the identifier of a recording.
.RS
.RE
.TP
.B \f[CB]maxage=\f[R]\f[I]time\f[R]
Specifies the maximum age of disk data to keep for the recording.
This parameter is valid only when the \f[CB]disk\f[R] parameter is set to
\f[CB]true\f[R].
Append \f[CB]s\f[R] to specify the time in seconds, \f[CB]m\f[R] for
minutes, \f[CB]h\f[R] for hours, or \f[CB]d\f[R] for days (for example,
specifying \f[CB]30s\f[R] means 30 seconds).
By default, the maximum age isn\[aq]t limited, and this parameter is set
to \f[CB]0s\f[R].
.RS
.RE
.TP
.B \f[CB]maxsize=\f[R]\f[I]size\f[R]
Specifies the maximum size (in bytes) of disk data to keep for the
recording.
This parameter is valid only when the \f[CB]disk\f[R] parameter is set to
\f[CB]true\f[R].
The value must not be less than the value for the \f[CB]maxchunksize\f[R]
parameter set with \f[CB]\-XX:FlightRecorderOptions\f[R].
Append \f[CB]m\f[R] or \f[CB]M\f[R] to specify the size in megabytes, or
\f[CB]g\f[R] or \f[CB]G\f[R] to specify the size in gigabytes.
By default, the maximum size of disk data isn\[aq]t limited, and this
parameter is set to \f[CB]0\f[R].
.RS
.RE
.TP
.B \f[CB]path\-to\-gc\-roots=\f[R]{\f[CB]true\f[R]|\f[CB]false\f[R]}
Specifies whether to collect the path to garbage collection (GC) roots
at the end of a recording.
By default, this parameter is disabled.
.RS
.PP
The path to GC roots is useful for finding memory leaks, but collecting
it is time\-consuming.
Enable this option only when you start a recording for an application
that you suspect has a memory leak.
If the \f[CB]settings\f[R] parameter is set to \f[CB]profile\f[R], the stack
trace from where the potential leaking object was allocated is included
in the information collected.
.RE
.TP
.B \f[CB]settings=\f[R]\f[I]path\f[R]
Specifies the path and name of the event settings file (of type JFC).
By default, the \f[CB]default.jfc\f[R] file is used, which is located in
\f[CB]JAVA_HOME/lib/jfr\f[R].
This default settings file collects a predefined set of information with
low overhead, so it has minimal impact on performance and can be used
with recordings that run continuously.
.RS
.PP
A second settings file is also provided, profile.jfc, which provides
more data than the default configuration, but can have more overhead and
impact performance.
Use this configuration for short periods of time when more information
is needed.
.RE
.PP
You can specify values for multiple parameters by separating them with a
comma.
Event settings and .jfc options can be specified using the following
syntax:
.TP
.B \f[CB]option=\f[R]\f[I]value\f[R]
Specifies the option value to modify.
To list available options, use the \f[CB]JAVA_HOME\f[R]/bin/jfr tool.
.RS
.RE
.TP
.B \f[CB]event\-setting\f[R]=\f[I]value\f[R]
Specifies the event setting value to modify.
Use the form: #= To add a new event setting, prefix the event name with
\[aq]+\[aq].
.RS
.RE
.PP
You can specify values for multiple event settings and .jfc options by
separating them with a comma.
In case of a conflict between a parameter and a .jfc option, the
parameter will take precedence.
The whitespace delimiter can be omitted for timespan values, i.e.
20ms.
For more information about the settings syntax, see Javadoc of the
jdk.jfr package.
.RE
.TP
.B \f[CB]\-XX:ThreadStackSize=\f[R]\f[I]size\f[R]
Sets the Java thread stack size (in kilobytes).
Use of a scaling suffix, such as \f[CB]k\f[R], results in the scaling of
the kilobytes value so that \f[CB]\-XX:ThreadStackSize=1k\f[R] sets the
Java thread stack size to 1024*1024 bytes or 1 megabyte.
The default value depends on the platform:
.RS
.IP \[bu] 2
Linux/x64 (64\-bit): 1024 KB
.IP \[bu] 2
macOS (64\-bit): 1024 KB
.IP \[bu] 2
Windows: The default value depends on virtual memory
.PP
The following examples show how to set the thread stack size to 1
megabyte in different units:
.IP
.nf
\f[CB]
\-XX:ThreadStackSize=1k
\-XX:ThreadStackSize=1024
\f[R]
.fi
.PP
This option is similar to \f[CB]\-Xss\f[R].
.RE
.TP
.B \f[CB]\-XX:\-UseCompressedOops\f[R]
Disables the use of compressed pointers.
By default, this option is enabled, and compressed pointers are used.
This will automatically limit the maximum ergonomically determined Java
heap size to the maximum amount of memory that can be covered by
compressed pointers.
By default this range is 32 GB.
.RS
.PP
With compressed oops enabled, object references are represented as
32\-bit offsets instead of 64\-bit pointers, which typically increases
performance when running the application with Java heap sizes smaller
than the compressed oops pointer range.
This option works only for 64\-bit JVMs.
.PP
It\[aq]s possible to use compressed pointers with Java heap sizes
greater than 32 GB.
See the \f[CB]\-XX:ObjectAlignmentInBytes\f[R] option.
.RE
.TP
.B \f[CB]\-XX:\-UseContainerSupport\f[R]
The VM now provides automatic container detection support, which allows
the VM to determine the amount of memory and number of processors that
are available to a Java process running in docker containers.
It uses this information to allocate system resources.
This support is only available on Linux x64 platforms.
If supported, the default for this flag is \f[CB]true\f[R], and container
support is enabled by default.
It can be disabled with \f[CB]\-XX:\-UseContainerSupport\f[R].
.RS
.PP
Unified Logging is available to help to diagnose issues related to this
support.
.PP
Use \f[CB]\-Xlog:os+container=trace\f[R] for maximum logging of container
information.
See \f[B]Enable Logging with the JVM Unified Logging Framework\f[R] for a
description of using Unified Logging.
.RE
.TP
.B \f[CB]\-XX:+UseHugeTLBFS\f[R]
\f[B]Linux only:\f[R] This option is the equivalent of specifying
\f[CB]\-XX:+UseLargePages\f[R].
This option is disabled by default.
This option pre\-allocates all large pages up\-front, when memory is
reserved; consequently the JVM can\[aq]t dynamically grow or shrink
large pages memory areas; see \f[CB]\-XX:UseTransparentHugePages\f[R] if
you want this behavior.
.RS
.PP
See \f[B]Large Pages\f[R].
.RE
.TP
.B \f[CB]\-XX:+UseLargePages\f[R]
Enables the use of large page memory.
By default, this option is disabled and large page memory isn\[aq]t
used.
.RS
.PP
See \f[B]Large Pages\f[R].
.RE
.TP
.B \f[CB]\-XX:+UseTransparentHugePages\f[R]
\f[B]Linux only:\f[R] Enables the use of large pages that can dynamically
grow or shrink.
This option is disabled by default.
You may encounter performance problems with transparent huge pages as
the OS moves other pages around to create huge pages; this option is
made available for experimentation.
.RS
.RE
.TP
.B \f[CB]\-XX:+AllowUserSignalHandlers\f[R]
Enables installation of signal handlers by the application.
By default, this option is disabled and the application isn\[aq]t
allowed to install signal handlers.
.RS
.RE
.TP
.B \f[CB]\-XX:VMOptionsFile=\f[R]\f[I]filename\f[R]
Allows user to specify VM options in a file, for example,
\f[CB]java\ \-XX:VMOptionsFile=/var/my_vm_options\ HelloWorld\f[R].
.RS
.RE
.SH ADVANCED JIT COMPILER OPTIONS FOR JAVA
.PP
These \f[CB]java\f[R] options control the dynamic just\-in\-time (JIT)
compilation performed by the Java HotSpot VM.
.TP
.B \f[CB]\-XX:AllocateInstancePrefetchLines=\f[R]\f[I]lines\f[R]
Sets the number of lines to prefetch ahead of the instance allocation
pointer.
By default, the number of lines to prefetch is set to 1:
.RS
.RS
.PP
\f[CB]\-XX:AllocateInstancePrefetchLines=1\f[R]
.RE
.RE
.TP
.B \f[CB]\-XX:AllocatePrefetchDistance=\f[R]\f[I]size\f[R]
Sets the size (in bytes) of the prefetch distance for object allocation.
Memory about to be written with the value of new objects is prefetched
up to this distance starting from the address of the last allocated
object.
Each Java thread has its own allocation point.
.RS
.PP
Negative values denote that prefetch distance is chosen based on the
platform.
Positive values are bytes to prefetch.
Append the letter \f[CB]k\f[R] or \f[CB]K\f[R] to indicate kilobytes,
\f[CB]m\f[R] or \f[CB]M\f[R] to indicate megabytes, or \f[CB]g\f[R] or
\f[CB]G\f[R] to indicate gigabytes.
The default value is set to \-1.
.PP
The following example shows how to set the prefetch distance to 1024
bytes:
.RS
.PP
\f[CB]\-XX:AllocatePrefetchDistance=1024\f[R]
.RE
.RE
.TP
.B \f[CB]\-XX:AllocatePrefetchInstr=\f[R]\f[I]instruction\f[R]
Sets the prefetch instruction to prefetch ahead of the allocation
pointer.
Possible values are from 0 to 3.
The actual instructions behind the values depend on the platform.
By default, the prefetch instruction is set to 0: