{"id":2930,"date":"2023-07-14T14:54:53","date_gmt":"2023-07-14T06:54:53","guid":{"rendered":"https:\/\/xinchewhd.com.cn\/?p=2930"},"modified":"2023-07-14T14:54:54","modified_gmt":"2023-07-14T06:54:54","slug":"jvm%e5%9b%be%e8%a7%a3","status":"publish","type":"post","link":"https:\/\/xinchewhd.com.cn\/index.php\/jvm\/jvm%e5%9b%be%e8%a7%a3\/","title":{"rendered":"JVM\u56fe\u89e3"},"content":{"rendered":"<link rel=\"stylesheet\" href=\"https:\/\/csdnimg.cn\/release\/blogv2\/dist\/mdeditor\/css\/editerView\/kdoc_html_views-1a98987dfd.css\">\n \t<link rel=\"stylesheet\" href=\"https:\/\/csdnimg.cn\/release\/blogv2\/dist\/mdeditor\/css\/editerView\/ck_htmledit_views-25cebea3f9.css\">\n<div id=\"content_views\" class=\"markdown_views prism-atom-one-dark\">\n <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"display: none;\"> <path stroke-linecap=\"round\" d=\"M5,0 0,2.5 5,5z\" id=\"raphael-marker-block\" style=\"-webkit-tap-highlight-color: rgba(0, 0, 0, 0);\"><\/path>\n <\/svg><\/p>\n<h1><a id=\"JVM_0\"><\/a>JVM\u56fe\u89e3<\/h1>\n<h2><a id=\"JVM_2\"><\/a>\u4e00\u3001JVM\u7684\u8fd0\u884c\u65f6\u6570\u636e\u533a<\/h2>\n<p>\u6982\u89c8JVM\u8fd0\u884c\u65f6\u6570\u636e\u533a\u4e3b\u8981\u5305\u62ec\u4ee5\u4e0b\u51e0\u4e2a\u90e8\u5206\uff1a\u7a0b\u5e8f\u8ba1\u6570\u5668\u3001\u865a\u62df\u673a\u6808\u3001\u672c\u5730\u65b9\u6cd5\u6808\u3001\u65b9\u6cd5\u533a\u3001\u5806\uff1b\u5176\u4e2d \u6808\u662f\u8fd0\u884c\u65f6\u7684\u5355\u4f4d\uff0c\u800c\u5806\u662f\u5b58\u50a8\u7684\u5355\u4f4d\uff01<\/p>\n<p><img decoding=\"async\" class=\"lazyload\"data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-26\/2023071414532619195e43b.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" alt=\"Image\"><noscript><img decoding=\"async\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-26\/2023071414532619195e43b.png\" alt=\"Image\"><\/noscript><\/p>\n<h3><a id=\"1_8\"><\/a>1.\u7a0b\u5e8f\u8ba1\u6570\u5668<\/h3>\n<p>\u7a0b\u5e8f\u8ba1\u6570\u5668\u53ef\u4ee5\u770b\u4f5c\u662f\u5f53\u524d\u7ebf\u7a0b\u6240\u6267\u884c\u7684\u5b57\u8282\u7801\u7684 \u884c\u53f7\u6307\u793a\u5668 \u53ef\u4ee5\u901a\u8fc7javap -c xxx.class\u6267\u884c\u67e5\u770b\u5b57\u8282\u7801\u6587\u4ef6<\/p>\n<p><img decoding=\"async\" class=\"lazyload\"data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-27\/20230714145327b2b27b928.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" alt=\"Image\"><noscript><img decoding=\"async\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-27\/20230714145327b2b27b928.png\" alt=\"Image\"><\/noscript><\/p>\n<p>\u5b57\u8282\u7801\u89e3\u91ca\u5668\u5de5\u4f5c\u65f6\u5c31\u662f\u901a\u8fc7\u6539\u53d8\u8fd9\u4e2a\u8ba1\u6570\u5668\u7684\u503c\u6765\u9009\u53d6\u4e0b\u4e00\u6761\u9700\u8981\u6267\u884c\u7684\u5b57\u8282\u7801\u6307\u4ee4\uff0c\u5206\u652f\u3001\u5faa\u73af\u3001\u8df3\u8f6c\u3001\u5f02\u5e38\u5904\u7406\u3001\u7ebf\u7a0b\u6062\u590d\u7b49\u57fa\u7840\u529f\u80fd\u90fd\u9700\u8981\u4f9d\u8d56\u8fd9\u4e2a\u8ba1\u6570\u5668\u6765\u5b8c\u6210\u3002<\/p>\n<p>\u5982\u679c\u7ebf\u7a0b\u6b63\u5728\u6267\u884c\u7684\u662f\u4e00\u4e2aJava\u65b9\u6cd5\uff0c\u8fd9\u4e2a\u8ba1\u6570\u5668\u8bb0\u5f55\u7684\u662f\u6b63\u5728\u6267\u884c\u7684\u865a\u62df\u673a\u5b57\u8282\u7801\u6307\u4ee4\u7684\u5730\u5740\u3002<\/p>\n<h3><a id=\"2_18\"><\/a>2.\u865a\u62df\u673a\u6808<\/h3>\n<p><img decoding=\"async\" class=\"lazyload\"data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-28\/202307141453283d3d53eb4.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" alt=\"Image\"><noscript><img decoding=\"async\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-28\/202307141453283d3d53eb4.png\" alt=\"Image\"><\/noscript><\/p>\n<h5><a id=\"21__24\"><\/a>2.1 \u865a\u62df\u673a\u6808<\/h5>\n<p>\u865a\u62df\u673a\u6808\u63cf\u8ff0\u7684\u662f Java\u65b9\u6cd5\u6267\u884c\u7684\u5185\u5b58\u6a21\u578b\uff1a<br \/>\n\u6bcf\u4e2a\u65b9\u6cd5\u5728\u6267\u884c\u7684\u540c\u65f6\u90fd\u4f1a\u521b\u5efa\u4e00\u4e2a<code>\u6808\u5e27<\/code>\uff0c\u7528\u4e8e\u5b58\u50a8\u5c40\u90e8\u53d8\u91cf\u8868\u3001\u64cd\u4f5c\u6570\u6808\u3001\u52a8\u6001\u94fe\u63a5\u3001\u65b9\u6cd5\u51fa\u53e3\u7b49\u4fe1\u606f\u3002\u6bcf\u4e00\u4e2a\u65b9\u6cd5\u4ece\u8c03\u7528\u76f4\u81f3\u6267\u884c\u5b8c\u6210\u7684\u8fc7\u7a0b\uff0c\u5c31\u5bf9\u5e94\u7740\u4e00\u4e2a\u6808\u5e27\u5728\u865a\u62df\u673a\u6808\u4e2d\u5165\u6808\u5230\u51fa\u6808\u7684\u8fc7\u7a0b\u3002<code>\u6808\u5e27\uff08Stack Frame\uff09<\/code>\u662f\u7528\u4e8e\u652f\u6301\u865a\u62df\u673a\u8fdb\u884c<code>\u65b9\u6cd5\u8c03\u7528<\/code>\u548c<code>\u65b9\u6cd5\u6267\u884c<\/code>\u7684\u6570\u636e\u7ed3\u6784\uff0c\u662f\u865a\u62df\u673a\u6808\u7684\u6808\u5143\u7d20\u3002<\/p>\n<p>\u6808\u5e27\u5b58\u50a8\u4e86\u65b9\u6cd5\u7684\u5c40\u90e8\u53d8\u91cf\u8868\u3001\u64cd\u4f5c\u6570\u6808\u3001\u52a8\u6001\u8fde\u63a5\u548c\u65b9\u6cd5\u8fd4\u56de\u5730\u5740\u7b49\u4fe1\u606f\u3002\u6bcf\u4e00\u4e2a\u65b9\u6cd5\u4ece\u8c03\u7528\u5f00\u59cb\u81f3\u6267\u884c\u5b8c\u6210\u7684\u8fc7\u7a0b\uff0c\u90fd\u5bf9\u5e94\u7740\u4e00\u4e2a\u6808\u5e27\u5728\u865a\u62df\u673a\u91cc\u4ece\u5165\u6808\u5230\u51fa\u6808\u7684\u8fc7\u7a0b\u3002<\/p>\n<blockquote><p>\u7b80\u5355\u6765\u8bb2\uff1a\u6bcf\u4e2a\u65b9\u6cd5\u90fd\u4f1a\u5bf9\u5e94\u5728\u865a\u62df\u673a\u6808\u4e2d\u751f\u6210\u4e00\u4e2a\u6808\u5e27\uff0c\u4ee5\u6808\u7684\u6570\u636e\u7ed3\u6784\u8fdb\u884c\u5b58\u653e\u6240\u6709\u7684\u6808\u5e27\u3002<\/p><\/blockquote>\n<h5><a id=\"22__33\"><\/a>2.2 \u5c40\u90e8\u53d8\u91cf\u8868<\/h5>\n<p>\u5c40\u90e8\u53d8\u91cf\u8868\u662f\u4e00\u7ec4\u53d8\u91cf\u503c\u5b58\u50a8\u7a7a\u95f4\uff0c\u7528\u4e8e\u5b58\u653e\u65b9\u6cd5\u53c2\u6570\u548c\u65b9\u6cd5\u5185\u90e8\u5b9a\u4e49\u7684\u5c40\u90e8\u53d8\u91cf\uff1a<\/p>\n<p>\uff081\uff09\u7f16\u8bd1\u65f6\u5c31\u786e\u5b9a\u6700\u5927\u5bb9\u91cf<\/p>\n<p>\u5728Java\u7a0b\u5e8f\u7f16\u8bd1\u4e3aClass\u6587\u4ef6\u65f6\uff0c\u5c31\u5728Class\u6587\u4ef6\u7684\u65b9\u6cd5\u8868\u7684Code\u5c5e\u6027\u7684 max_locals \u6570\u636e\u9879\u4e2d\u786e\u5b9a\u4e86\u8be5\u65b9\u6cd5\u6240\u9700\u8981\u5206\u914d\u7684\u5c40\u90e8\u53d8\u91cf\u8868\u7684\u6700\u5927\u5bb9\u91cf\u3002<\/p>\n<p>\uff082\uff09\u5c40\u90e8\u53d8\u91cf\u8868\u7684\u5bb9\u91cf\u4ee5\u53d8\u91cf\u69fd\uff08Slot\uff09\u4e3a\u6700\u5c0f\u5355\u4f4d<\/p>\n<p>\u4e00\u4e2aSlot\u53ef\u4ee5\u5b58\u653e\u4e00\u4e2a32\u4f4d\u4ee5\u5185\u7684\u6570\u636e\u7c7b\u578b\uff0cJava\u4e2d\u5360\u752832\u4f4d\u4ee5\u5185\u7684\u6570\u636e\u7c7b\u578b\u67098\u79cd\uff1a boolean \u3001byte\u3001char\u3001short\u3001int\u3001float\u3001reference \u548c returnAddress; \u5bf9\u4e8e 64\u4f4d\u7684\u6570\u636e\u7c7b\u578b\uff08long\/double\uff09\uff0c\u865a\u62df\u673a\u4f1a\u4ee5\u9ad8\u4f4d\u5bf9\u9f50\u7684\u65b9\u5f0f\u5206\u914d\u4e24\u4e2a\u8fde\u7eed\u7684Slot\u7a7a\u95f4\u3002<\/p>\n<p>\uff083\uff09\u7d22\u5f15\u5b9a\u4f4d<\/p>\n<p>\u865a\u62df\u673a\u901a\u8fc7\u7d22\u5f15\u5b9a\u4f4d\u7684\u65b9\u5f0f\u4f7f\u7528\u5c40\u90e8\u53d8\u91cf\u8868\uff0c\u7d22\u5f15\u503c\u8303\u56f4\u662f\u4ece0\u81f3\u6700\u5927Slot\u6570\u91cf\u5bf932\u4f4d\u6570\u636e\u7c7b\u578b\u7684\u53d8\u91cf\u6765\u8bf4\uff0c\u7d22\u5f15n\u5c31\u4ee3\u8868\u4e86\u4f7f\u7528\u7b2cn\u4e2aSlot\uff1b\u800c\u5bf964\u4f4d\u6570\u636e\u7c7b\u578b\u7684\u53d8\u91cf\u6765\u8bf4\uff0c\u5219\u4f1a\u540c\u65f6\u4f7f\u7528n\u548cn+1\u4e24\u4e2aSlot;<\/p>\n<p>\u5176\u4e2d\uff0c\u7d22\u5f15\u4f4d\u7f6e0\uff0c\u9ed8\u8ba4\u662fthis\u3002<\/p>\n<p>\uff084\uff09\u7d22\u5f15\u5206\u914d<\/p>\n<p>\u5728\u65b9\u6cd5\u6267\u884c\u65f6\uff0c\u865a\u62df\u673a\u662f\u4f7f\u7528\u5c40\u90e8\u53d8\u91cf\u8868\u6765\u5b8c\u6210\u53c2\u6570\u503c\u5230\u53c2\u6570\u53d8\u91cf\u5217\u8868\u7684\u4f20\u9012\u8fc7\u7a0b\u7684\u5982\u679c\u6267\u884c\u7684\u662f\u5b9e\u4f8b\u65b9\u6cd5\uff0c\u5219\u5c40\u90e8\u53d8\u91cf\u8868\u4e2d\u7b2c0\u4f4d\u7d22\u5f15\u7684Slot\u9ed8\u8ba4\u662f\u7528\u4e8e\u4f20\u9012\u65b9\u6cd5\u6240\u5c5e\u5bf9\u8c61\u5b9e\u4f8b\u7684\u5f15\u7528\uff0c\u5728\u65b9\u6cd5\u4e2d\u53ef\u4ee5\u901a\u8fc7\u5173\u952e\u5b57\u201cthis\u201d\u6765\u8bbf\u95ee\u5230\u8fd9\u4e2a\u9690\u542b\u7684\u53c2\u6570\uff1b\u5176\u4f59\u53c2\u6570\u6309\u7167\u53c2\u6570\u8868\u987a\u5e8f\u6392\u5217\uff0c\u5360\u7528\u4ece1\u5f00\u59cb\u7684\u5c40\u90e8\u53d8\u91cfSlot\uff1b\u53c2\u6570\u8868\u5206\u914d\u5b8c\u6bd5\u540e\uff0c\u518d\u6839\u636e\u65b9\u6cd5\u4f53\u5185\u90e8\u5b9a\u4e49\u7684\u53d8\u91cf\u987a\u5e8f\u548c\u4f5c\u7528\u57df\u5206\u914d\u5176\u4f59\u7684Slot\u3002<\/p>\n<p>\uff085\uff09Slot\u91cd\u7528<\/p>\n<p>\u5c40\u90e8\u53d8\u91cf\u8868\u4e2d\u7684Slot\u662f\u53ef\u4ee5\u91cd\u7528\u7684\uff0c\u5982\u679c\u5f53\u524d\u5b57\u8282\u7801PC\u8ba1\u6570\u5668\u7684\u503c\uff0c\u5df2\u7ecf\u8d85\u8fc7\u4e86\u67d0\u4e2a\u53d8\u91cf\u7684\u4f5c\u7528\u57df\uff0c\u90a3\u8fd9\u4e2a\u53d8\u91cf\u5bf9\u5e94\u7684Slot\u5c31\u53ef\u4ee5\u4ea4\u7ed9\u5176\u4ed6\u53d8\u91cf\u4f7f\u7528\u3002<\/p>\n<h5><a id=\"23__59\"><\/a>2.3 \u64cd\u4f5c\u6570\u6808<\/h5>\n<p>\u5728\u65b9\u6cd5\u7684\u6267\u884c\u8fc7\u7a0b\u4e2d\uff0c\u4f1a\u6709\u5404\u79cd\u5b57\u8282\u7801\u6307\u4ee4\u5f80\u64cd\u4f5c\u6570\u6808\u4e2d\u5199\u5165\u548c\u63d0\u53d6\u5185\u5bb9\uff0c\u8fd9\u5c31\u662f\u5165\u6808\u548c\u51fa\u6808\u3002<\/p>\n<p>\u64cd\u4f5c\u6570\u6808\u662f\u4e3a\u5b57\u8282\u7801\u6307\u4ee4\u670d\u52a1\u7684\uff1a<\/p>\n<p>\u4f8b\u5982\uff0c\u865a\u62df\u673a\u6267\u884c\u5b57\u8282\u7801\u6307\u4ee4 iload ,\u4f1a\u5c06\u4e00\u4e2aint\u7c7b\u578b\u7684\u5c40\u90e8\u53d8\u91cf\u4ece\u5c40\u90e8\u53d8\u91cf\u8868\u52a0\u8f7d\u5230\u64cd\u4f5c\u6570\u6808\uff0ciadd\u4f1a\u5c06\u64cd\u4f5c\u6808\u9876\u7684\u4e24\u4e2a\u5143\u7d20\u76f8\u52a0 \uff0c\u5e76\u5c06\u76f8\u52a0\u540e\u7684\u7ed3\u679c\u5165\u6808\u3002<\/p>\n<h5><a id=\"24__67\"><\/a>2.4 \u52a8\u6001\u8fde\u63a5<\/h5>\n<p>\u52a8\u6001\u8fde\u63a5\u5c31\u662f<code>\u6307\u5411\u5e38\u91cf\u6c60<\/code>\u4e2d\u8be5\u6808\u5e27\u6240\u5c5e\u65b9\u6cd5\u7684\u5f15\u7528\u3002<\/p>\n<p>\u6bcf\u4e2a\u6808\u5e27\u90fd\u5305\u542b\u4e00\u4e2a\u6307\u5411\u8fd0\u884c\u65f6\u5e38\u91cf\u6c60\u4e2d\u8be5\u6808\u5e27\u6240\u5c5e\u65b9\u6cd5\u7684\u5f15\u7528\uff0c\u6301\u6709\u8fd9\u4e2a\u5f15\u7528\u662f\u4e3a\u4e86\u652f\u6301\u65b9\u6cd5\u8c03\u7528\u8fc7\u7a0b\u4e2d\u7684\u52a8\u6001\u8fde\u63a5\u3002<\/p>\n<p>Class\u6587\u4ef6\u7684\u5e38\u91cf\u6c60\u4e2d\u5b58\u6709\u5927\u91cf\u7684\u7b26\u53f7\u5f15\u7528\uff0c\u5b57\u8282\u7801\u4e2d\u7684\u65b9\u6cd5\u8c03\u7528\u6307\u4ee4\u5c31\u4ee5\u5e38\u91cf\u6c60\u4e2d\u6307\u5411\u65b9\u6cd5\u7684\u7b26\u53f7\u5f15\u7528\u4f5c\u4e3a\u53c2\u6570\u3002<\/p>\n<p>\u8fd9\u4e9b\u7b26\u53f7\u5f15\u7528\u4e00\u90e8\u5206\u4f1a\u5728\u7c7b\u52a0\u8f7d\u9636\u6bb5\u6216\u8005\u7b2c\u4e00\u6b21\u4f7f\u7528\u7684\u65f6\u5019\u8f6c\u5316\u4e3a\u76f4\u63a5\u5f15\u7528\uff0c\u8fd9\u79cd\u8f6c\u5316\u79f0\u4e3a<strong>\u9759\u6001\u89e3\u6790<\/strong><\/p>\n<p>\u53e6\u4e00\u90e8\u5206\u5c06\u5728\u6bcf\u4e00\u6b21\u8fd0\u884c\u671f\u95f4\u8f6c\u4e3a\u76f4\u63a5\u5f15\u7528\uff0c\u8fd9\u90e8\u5206\u79f0\u4e3a<strong>\u52a8\u6001\u8fde\u63a5<\/strong>\u3002<\/p>\n<h5><a id=\"25__79\"><\/a>2.5 \u65b9\u6cd5\u8fd4\u56de\u5730\u5740<\/h5>\n<p>\u4e00\u4e2a\u65b9\u6cd5\u7684\u9000\u51fa\u65b9\u5f0f\u6709\u4e24\u79cd\uff1a<\/p>\n<p>\u6b63\u5e38\u5b8c\u6210\u51fa\u53e3\uff1a\u6267\u884c\u5f15\u64ce\u9047\u5230\u4efb\u610f\u4e00\u4e2a\u65b9\u6cd5\u8fd4\u56de\u7684\u5b57\u8282\u7801\u6307\u4ee4\u3002<\/p>\n<p>\u5f02\u5e38\u5b8c\u6210\u51fa\u53e3\uff1a\u5728\u65b9\u6cd5\u6267\u884c\u8fc7\u7a0b\u4e2d\u9047\u5230\u4e86\u5f02\u5e38\uff0c\u5e76\u4e14\u8fd9\u4e2a\u5f02\u5e38\u6ca1\u6709\u5728\u65b9\u6cd5\u4f53\u5185\u5f97\u5230\u5904\u7406\uff0c\u4e5f\u5c31\u662f\u5728\u672c\u65b9\u6cd5\u7684\u5f02\u5e38\u8868\u4e2d\u6ca1\u6709\u641c\u7d22\u5230\u5339\u914d\u7684\u5f02\u5e38\u5904\u7406\u5668\uff0c\u8fd9\u65f6\u5c31\u4f1a\u5bfc\u81f4\u65b9\u6cd5\u5f02\u5e38\u9000\u51fa\u3002<\/p>\n<p><code>\u65b9\u6cd5\u8fd4\u56de\u5730\u5740<\/code>\uff1a<\/p>\n<p>\u4e00\u822c\u6765\u8bf4\uff0c\u65b9\u6cd5\u6b63\u5e38\u9000\u51fa\u65f6\uff0c\u8c03\u7528\u8005\u7684PC\u8ba1\u6570\u5668\u7684\u503c\u53ef\u4ee5\u4f5c\u4e3a\u8fd4\u56de\u5730\u5740\uff0c\u6808\u5e27\u4e2d\u5f88\u53ef\u80fd\u4f1a\u4fdd\u5b58\u8fd9\u4e2a\u8ba1\u6570\u5668\u503c\u3002\u800c\u65b9\u6cd5\u5f02\u5e38\u9000\u51fa\u65f6\uff0c\u8fd4\u56de\u5730\u5740\u662f\u8981\u901a\u8fc7\u5f02\u5e38\u5904\u7406\u5668\u8868\u6765\u786e\u5b9a\u7684\uff0c\u6808\u5e27\u4e2d\u4e00\u822c\u4e0d\u4f1a\u4fdd\u5b58\u8fd9\u90e8\u5206\u4fe1\u606f\u3002<\/p>\n<p>\u65b9\u6cd5\u9000\u51fa\u7684\u8fc7\u7a0b\u5b9e\u9645\u4e0a\u5c31\u7b49\u540c\u4e8e\u628a\u5f53\u524d\u6808\u5e27\u51fa\u6808\uff1a<\/p>\n<p>\u56e0\u6b64\u9000\u51fa\u65f6\u53ef\u80fd\u6267\u884c\u7684\u64cd\u4f5c\u6709\uff1a\u6062\u590d\u4e0a\u5c42\u65b9\u6cd5\u7684\u5c40\u90e8\u53d8\u91cf\u8868\u548c\u64cd\u4f5c\u6570\u6808\uff0c\u628a\u8fd4\u56de\u503c\u538b\u5165\u8c03\u7528\u8005\u6808\u5e27\u7684\u64cd\u4f5c\u6570\u6808\u4e2d\uff0c\u8c03\u6574PC\u8ba1\u6570\u5668\u7684\u503c\u4ee5\u6307\u5411\u65b9\u6cd5\u8c03\u7528\u6307\u4ee4\u540e\u9762\u7684\u4e00\u6761\u6307\u4ee4\u7b49\u3002<\/p>\n<h3><a id=\"3_95\"><\/a>3.\u5806<\/h3>\n<p><img decoding=\"async\" class=\"lazyload\"data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-28\/202307141453289d9d05411.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" alt=\"Image\"><noscript><img decoding=\"async\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-28\/202307141453289d9d05411.png\" alt=\"Image\"><\/noscript><\/p>\n<p>Java\u5806\u5728\u865a\u62df\u673a\u542f\u52a8\u65f6\u521b\u5efa\uff0c\u552f\u4e00\u76ee\u7684\u5c31\u662f\u5b58\u653e\u5bf9\u8c61\u5b9e\u4f8b \u4ee5\u53ca \u6570\u7ec4\u3002<\/p>\n<p>\uff081\uff09\u4ece\u5185\u5b58\u56de\u6536\u7684\u89d2\u5ea6\u6765\u770b\uff0cJava\u5806\u662f\u5783\u573e\u6536\u96c6\u5668\u7ba1\u7406\u7684\u4e3b\u8981\u533a\u57df\u3002<\/p>\n<p>\u7531\u4e8e\u76ee\u524d\u7684\u5783\u573e\u6536\u96c6\u5668\u90fd\u91c7\u7528\u5206\u4ee3\u6536\u96c6\u7b97\u6cd5\uff0c\u56e0\u6b64Java\u5806\u4e2d\u8fd8\u53ef\u7ec6\u5206\u4e3a\uff1a\u65b0\u751f\u4ee3\u548c\u8001\u5e74\u4ee3\uff0c\u9ed8\u8ba4\u5360\u6bd4\u4e3aYoung:Old = 1:2\u3002\u540c\u65f6\u65b0\u751f\u4ee3\u4e2d\u91c7\u7528\u590d\u5236\u7b97\u6cd5\uff0c\u5c06\u65b0\u751f\u4ee3\u5206\u4e3a\u4e09\u4e2a\u533a\u57df\uff0c\u9ed8\u8ba4\u5360\u6bd4\u4e3a\uff1aEden:from:to=8:1:1\u3002<\/p>\n<p>\uff082\uff09\u4ece\u5185\u5b58\u5206\u914d\u7684\u89d2\u5ea6\u6765\u770b\uff0c\u7ebf\u7a0b\u5171\u4eab\u7684Java\u5806\u4e2d\u53ef\u80fd\u5212\u5206\u51fa\u591a\u4e2a\u7ebf\u7a0b\u79c1\u6709\u7684\u5206\u914d\u7f13\u51b2\u533a\uff08Thread Local Allocation Buffer\uff09<\/p>\n<h3><a id=\"4_107\"><\/a>4.\u65b9\u6cd5\u533a<\/h3>\n<p><img decoding=\"async\" class=\"lazyload\"data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-28\/2023071414532849499481f.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" alt=\"Image\"><noscript><img decoding=\"async\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-28\/2023071414532849499481f.png\" alt=\"Image\"><\/noscript><\/p>\n<p>\u65b9\u6cd5\u533a\u7528\u4e8e\u5b58\u50a8\u5df2\u88ab\u865a\u62df\u673a\u52a0\u8f7d\u7684<code>\u7c7b\u5143\u4fe1\u606f\uff08\u5373Class\u5bf9\u8c61\uff09<\/code>\u3001<code>\u5e38\u91cf\u6c60\uff08\u8fd0\u884c\u65f6\u5e38\u91cf\u6c60\uff09<\/code>\u3001<code>\u9759\u6001\u53d8\u91cf<\/code>\u3001\u5373<code>\u65f6\u7f16\u8bd1\u5668\u7f16\u8bd1\u540e\u7684\u4ee3\u7801<\/code>\u7b49\u6570\u636e\u3002<\/p>\n<p>\u989d\u5916\u89e3\u91ca\uff1a\u7c7b\u5143\u4fe1\u606f(class metadata)\uff0c\u76f8\u5f53\u4e8ejava\u7c7b\u7f16\u8bd1\u540e(.class\u7c7b\u5bf9\u8c61)\u5728JVM\u4e2d\u7684\u4fe1\u606f\u3002<\/p>\n<p>\u7c7b\u5143\u4fe1\u606f\u4e2d\u5305\u542b\u4e86\uff1a<\/p>\n<ol>\n<li>Klass \u7ed3\u6784\uff0c\u8fd9\u4e2a\u975e\u5e38\u91cd\u8981\uff0c\u628a\u5b83\u7406\u89e3\u4e3a\u4e00\u4e2a Java \u7c7b\u5728\u865a\u62df\u673a\u5185\u90e8\u7684\u8868\u793a\uff1b<\/li>\n<li>method metadata\uff0c\u5305\u62ec\u65b9\u6cd5\u7684\u5b57\u8282\u7801\u3001\u5c40\u90e8\u53d8\u91cf\u8868\u3001\u5f02\u5e38\u8868\u3001\u53c2\u6570\u4fe1\u606f\u7b49\uff1b<\/li>\n<li>\u6ce8\u89e3\uff1b<\/li>\n<li>\u65b9\u6cd5\u8ba1\u6570\u5668\uff0c\u8bb0\u5f55\u65b9\u6cd5\u88ab\u6267\u884c\u7684\u6b21\u6570\uff0c\u7528\u6765\u8f85\u52a9 JIT \u51b3\u7b56\uff1b<\/li>\n<li>\u5176\u4ed6<br \/>\n<blockquote><p>\u5982\u679c\u4e00\u5fc3\u60f3\u8981\u6df1\u5165\u7814\u7a76\u5143\u7a7a\u95f4\u5185\uff0c\u5bf9\u8c61\u4e0e\u7c7b\u52a0\u8f7d\u5668\u4e4b\u95f4\u7684\u5173\u7cfb\uff0c\u548c\u5143\u7a7a\u95f4\u4e2d\u5b58\u653e\u7684\u6570\u636e\uff0c\u53ef\u4ee5\u770b\u770b\u8fd9\u4e2a\u6587\u6863\uff1a<\/p>\n<p>\u6df1\u5165\u7406\u89e3\u5806\u5916\u5185\u5b58 Metaspace.md (\u5982\u679c\u4e0b\u9762\u8fd9\u4e2a\u80fd\u770b\u61c2\uff0c\u90a3\u4e48\u53ef\u4ee5\u6765\u627e\u6211\u8981\u6587\u6863)<\/p>\n<p><img decoding=\"async\" class=\"lazyload\"data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-28\/20230714145328f4f4129c7.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" alt=\"image-20210714161949797\"><noscript><img decoding=\"async\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-28\/20230714145328f4f4129c7.png\" alt=\"image-20210714161949797\"><\/noscript><\/p><\/blockquote>\n<\/li>\n<\/ol>\n<blockquote><p>\u7406\u89e3<code>\u65b9\u6cd5\u533a<\/code>\u4e3a\u4e00\u4e2a\u7406\u8bba\u63a5\u53e3\uff0c\u5177\u4f53\u7684\u5b9e\u73b0\u65b9\u6848\u6709\u6c38\u4e45\u4ee3\u548c\u73b0\u5728\u7684\u5143\u7a7a\u95f4\u3002<\/p><\/blockquote>\n<p>\u5373\u65f6\u7f16\u8bd1\u540e\u7684\u4ee3\u7801\uff1a\u5373\u672c\u5730\u4ee3\u7801\uff0c\u4f18\u5316\u63d0\u9ad8\u4e86\u4ee3\u7801\u7684\u8fd0\u884c\u6548\u7387\uff0c\u8ddd\u79bb\u5e95\u5c42\u786c\u4ef6\u66f4\u52a0\u63a5\u8fd1\uff01\u4e00\u822c\u7528\u4e8e\u5904\u7406<code>\u70ed\u70b9\u4ee3\u7801(\u7f16\u8bd1\u5668\uff0c\u90fd\u662f\u4ee5\u6574\u4e2a\u65b9\u6cd5\u4f5c\u4e3a\u7f16\u8bd1\u5bf9\u8c61)<\/code>\uff0c\u4e5f\u5c31\u662f\u88ab\u591a\u6b21\u8c03\u7528\u7684\u65b9\u6cd5\u548c\u88ab\u591a\u6b21\u6267\u884c\u7684\u5faa\u73af\u4f53\u3002JIT\uff08just-in-time compilation\uff09\u5373\u65f6\u7f16\u8bd1\u5668\u7f16\u8bd1\u624d\u6709\u4e86\u7528\u6b66\u4e4b\u5730\uff0c\u5426\u5219\uff0c\u4e0d\u5982\u76f4\u63a5\u7528\u89e3\u91ca\u5668\u6267\u884c\u4ee3\u7801\u3002<\/p>\n<p>\u8d34\u56fe\uff1a<\/p>\n<p><img decoding=\"async\" class=\"lazyload\"data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-29\/202307141453295a5a95ccd.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" alt=\"image-20210714115559803\"><noscript><img decoding=\"async\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-29\/202307141453295a5a95ccd.png\" alt=\"image-20210714115559803\"><\/noscript><\/p>\n<blockquote><p>\u7f16\u8bd1\u7684\u7a7a\u95f4\u5f00\u9500\uff1a<\/p>\n<p>\u5bf9\u4e00\u822c\u7684Java\u65b9\u6cd5\u800c\u8a00\uff0c<strong>\u7f16\u8bd1\u540e\u4ee3\u7801\u7684\u5927\u5c0f\u76f8\u5bf9\u4e8e\u5b57\u8282\u7801\u7684\u5927\u5c0f\uff0c\u81a8\u80c0\u6bd4\u8fbe\u523010\u51e0\u500d<\/strong>\u662f\u5f88\u6b63\u5e38\u7684\u3002\u540c\u4e0a\u9762\u8bf4\u7684\u65f6\u95f4\u5f00\u9500\u4e00\u6837\uff0c\u8fd9\u91cc\u7684\u7a7a\u95f4\u5f00\u9500\u4e5f\u662f\uff0c<strong>\u53ea\u6709\u5bf9\u6267\u884c\u9891\u7e41\u7684\u4ee3\u7801\u624d\u503c\u5f97\u7f16\u8bd1<\/strong>\uff0c\u5982\u679c\u628a\u6240\u6709\u4ee3\u7801\u90fd\u7f16\u8bd1\u5219\u4f1a\u663e\u8457\u589e\u52a0\u4ee3\u7801\u6240\u5360\u7a7a\u95f4\uff0c\u5bfc\u81f4\u201c\u4ee3\u7801\u7206\u70b8\u201d\u3002<\/p>\n<p><em><strong>\u8fd9\u4e5f\u5c31\u89e3\u91ca\u4e86\u4e3a\u4ec0\u4e48\u6709\u4e9bJVM\u4f1a\u9009\u62e9\u4e0d\u603b\u662f\u505aJIT\u7f16\u8bd1\uff0c\u800c\u662f\u9009\u62e9\u7528\u89e3\u91ca\u5668+JIT\u7f16\u8bd1\u5668\u7684\u6df7\u5408\u6267\u884c\u5f15\u64ce\u3002<\/strong><\/em><\/p><\/blockquote>\n<p>\u5bf9\u4e8eHotSpot\u865a\u62df\u673a\u6765\u8bf4\uff0c\u4e5f\u79f0\u4e3a\u201c\u6c38\u4e45\u4ee3\u201d\uff08Permanent Generation\uff09<\/p>\n<blockquote><p>\u65b9\u6cd5\u533a\u7684\u53d8\u5316\uff1a<\/p>\n<p>jdk1.6\u53ca\u4ee5\u524d\uff1a\u6709\u6c38\u4e45\u4ee3(\u65b9\u6cd5\u533a\u7684\u5b9e\u73b0)\uff0c<strong>\u8fd0\u884c\u65f6\u5e38\u91cf\u6c60\u903b\u8f91\u5305\u542b\u5b57\u7b26\u4e32\u5e38\u91cf\u6c60<\/strong>\u5728\u65b9\u6cd5\u533a\u4e2d<\/p>\n<p>jdk1.7\uff1a\u6709\u6c38\u4e45\u4ee3\uff0c\u4f46\u5df2\u9010\u6b65\u201c\u53bb\u6c38\u4e45\u4ee3\u201d\uff0c<strong>\u5b57\u7b26\u4e32\u5e38\u91cf\u6c60<\/strong>\u8f6c\u79fb\u5230\u5806\u4e2d\uff0c<strong>\u8fd0\u884c\u65f6\u5e38\u91cf\u6c60<\/strong>\u8fd8\u5728\u65b9\u6cd5\u533a\u4e2d<\/p>\n<p>jdk1.8\u53ca\u4e4b\u540e\uff1a\u65e0\u6c38\u4e45\u4ee3\uff0c\u66ff\u6362\u4e3a\u5143\u7a7a\u95f4\uff0c<code>\u5b57\u7b26\u4e32\u5e38\u91cf\u6c60\u8fd8\u5728\u5806, \u8fd0\u884c\u65f6\u5e38\u91cf\u6c60\u8fd8\u5728\u65b9\u6cd5\u533a\u4e2d(\u5143\u7a7a\u95f4)<\/code><\/p><\/blockquote>\n<p>\u867d\u7136\u8fd9\u4e2a\u5143\u7a7a\u95f4\u8fd8\u80fd\u5f80\u91cc\u6316\uff0c\u4f46\u662f\uff0c\u4e0d\u63a8\u8350\u4e86\u2026\u2026\u540e\u9762\u7684\u5c31\u8d8a\u6765\u8d8a\u96be\u7406\u89e3\u4e86\u3002<\/p>\n<h2><a id=\"HotSpot_161\"><\/a>\u4e8c\u3001HotSpot\u865a\u62df\u673a\u5bf9\u8c61\u63a2\u79d8<\/h2>\n<h3><a id=\"1_163\"><\/a>1.\u5bf9\u8c61\u7684\u5185\u5b58\u7ed3\u6784<\/h3>\n<p><img decoding=\"async\" class=\"lazyload\"data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-29\/20230714145329fbfbe0e9a.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" alt=\"Image\"><noscript><img decoding=\"async\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-29\/20230714145329fbfbe0e9a.png\" alt=\"Image\"><\/noscript><\/p>\n<p>\u5728HotSpot\u865a\u62df\u673a\u4e2d\uff0c\u5bf9\u8c61\u7684\u5185\u5b58\u5e03\u5c40\u53ef\u5206\u4e3a\uff1a\u5bf9\u8c61\u5934\u3001\u5b9e\u4f8b\u6570\u636e\u3001\u5bf9\u9f50\u586b\u5145\u3002<\/p>\n<p>\u56fe\u89e3\u89e3\u91ca\uff1a<\/p>\n<p><code>MarkWord\u5bf9\u8c61\u5934<\/code>\uff1a\u5b58\u50a8\u5bf9\u8c61\u81ea\u8eab\u7684\u8fd0\u884c\u65f6\u6570\u636e\uff0c\u5982\u54c8\u5e0c\u7801\u3001GC\u5206\u4ee3\u5e74\u9f84\u3001\u9501\u72b6\u6001\u6807\u5fd7\u3001\u504f\u5411\u7ebf\u7a0bID\u7b49\u3002<\/p>\n<p><strong><code>\u6570\u7ec4\u957f\u5ea6<\/code><\/strong>\uff1a\u5982\u679c\u5bf9\u8c61\u662f\u6570\u7ec4\uff0c\u5219\u5bf9\u8c61\u5934\u4e2d\u8fd8\u5fc5\u987b\u6709\u4e00\u5757\u7528\u4e8e\u8bb0\u5f55\u6570\u7ec4\u957f\u5ea6\u7684\u6570\u636e\u3002<\/p>\n<p><code>klass point\u7c7b\u578b\u6307\u9488<\/code>\uff1a\u5373\u5bf9\u8c61\u6307\u5411\u5b83\u7684<code>\u7c7b\u5143\u6570\u636e(MetaData)<\/code>\u7684\u6307\u9488\uff0c\u5e76\u4e0d\u662f\u6240\u6709\u7684\u865a\u62df\u673a\u5b9e\u73b0\u90fd\u5fc5\u987b\u5728\u5bf9\u8c61\u6570\u636e\u4e0a\u4fdd\u7559\u7c7b\u578b\u6307\u9488\u3002(\u6700\u540e\u8fd9\u53e5\u8bdd\u7684\u610f\u601d\u662f\uff0c\u5982\u679c\u4f7f\u7528\u53e5\u67c4\uff0c\u5728\u540e\u9762\u8bb2\u4e86\uff0c\u5219\u4e0d\u4f1a\u5728\u5bf9\u8c61\u6570\u636e\u4e0a\u4fdd\u7559\u7c7b\u578b\u6307\u9488\uff0c\u800c\u662f\u5728\u5806\u91cc\u9762\u4e13\u95e8\u5f00\u8f9f\u4e86\u4e00\u4e2a\u53e5\u67c4\u6c60\u7a7a\u95f4\uff0c\u6765\u5b58\u653e)\u3002<\/p>\n<p>\u200b \u7c7b\u5143\u6570\u636e\uff1a<\/p>\n<p><code>\u5b9e\u4f8b\u6570\u636e<\/code>\uff1a\u4e5f\u5373\u5bf9\u8c61\u6210\u5458\u53d8\u91cf\u5b57\u6bb5\u5185\u5bb9\u3002<\/p>\n<p>\u200b <code>\u5b9e\u4f8b\u6570\u636e\u7684\u5b58\u50a8\u987a\u5e8f<\/code>\uff1a<strong>\u5b58\u50a8\u987a\u5e8f<\/strong>\u4f1a\u53d7\u5230\u865a\u62df\u673a\u5206\u914d\u7b56\u7565\u53c2\u6570\uff08FieldsAllocationStyle\uff09\u548c\u5b57\u6bb5\u5728Java\u6e90\u7801\u4e2d\u5b9a\u4e49\u987a\u5e8f\u7684\u5f71\u54cd\uff0c\u76f8\u540c\u5bbd\u5ea6\u7684\u5b57\u6bb5\u603b\u662f\u88ab\u5206\u914d\u5728\u4e00\u8d77\u3002<code>\u5728\u7236\u7c7b\u4e2d\u5b9a\u4e49\u7684\u53d8\u91cf\u4f1a\u51fa\u73b0\u5728\u5b50\u7c7b\u4e4b\u524d<\/code>\u3002<\/p>\n<p><code>\u5bf9\u9f50\u586b\u5145<\/code>\uff1a\u4ec5\u4ec5\u8d77\u5230\u5360\u4f4d\u7b26\u7684\u4f5c\u7528**\uff0c**\u7531\u4e8eHotSpot VM\u7684\u81ea\u52a8\u5185\u5b58\u7ba1\u7406\u7cfb\u7edf\u8981\u6c42\u5bf9\u8c61\u8d77\u59cb\u5730\u5740\u5fc5\u987b\u662f8\u5b57\u8282\u7684\u6574\u6570\u500d\uff0c\u4e5f\u5373\u5bf9\u8c61\u7684\u5927\u5c0f\u5fc5\u987b\u662f<code>8\u5b57\u8282\u7684\u6574\u6570\u500d<\/code>\u3002\u800c\u5bf9\u8c61\u5934\u6b63\u597d\u662f8\u5b57\u8282\u7684\u6574\u6570\u500d\uff081\u500d\u6216\u8005\u591a\u500d\uff09\uff0c\u56e0\u6b64\u5bf9\u8c61\u5b9e\u4f8b\u6570\u636e\u90e8\u5206\u6ca1\u6709\u5bf9\u9f50\u65f6\uff0c\u5c31\u9700\u8981\u901a\u8fc7\u5bf9\u9f50\u586b\u5145\u6765\u8865\u5168\u3002<\/p>\n<h4><a id=\"11_32_185\"><\/a>1.1 \u5bf9\u8c61\u5934\u56fe\u5f62\u5982\u4e0b(32\u4f4d)\uff1a<\/h4>\n<p><img decoding=\"async\" class=\"lazyload\"data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-29\/2023071414532976769ae44.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" alt=\"image-20210714093959940\"><noscript><img decoding=\"async\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-29\/2023071414532976769ae44.png\" alt=\"image-20210714093959940\"><\/noscript><\/p>\n<h4><a id=\"12_64JVMC_189\"><\/a>1.2 64\u4f4dJVM\u7684C\u8bed\u8a00\u6e90\u7801\u6ce8\u89e3\uff1a<\/h4>\n<p><img decoding=\"async\" class=\"lazyload\"data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-30\/20230714145330f3f3851c3.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" alt=\"image-20210714094114733\"><noscript><img decoding=\"async\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-30\/20230714145330f3f3851c3.png\" alt=\"image-20210714094114733\"><\/noscript><\/p>\n<blockquote><p>\u4e0e32\u4f4d\u56fe\u89e3\u7684\u533a\u522b\uff1a<\/p>\n<p>\u524d\u9762\u591a\u4e8625\u4f4d\u672a\u4f7f\u7528 unused\uff0c\u4e2d\u95f4\u591a\u4e86\u4e00\u4f4dunused\uff0c\u5269\u4e0b\u7684\u5dee\u8ddd\u4e0d\u5927\uff0c\u9664\u4e86\u6bd432\u4f4d\u957f\u4e00\u70b9\u3002<\/p><\/blockquote>\n<h4><a id=\"13_javaOOP_197\"><\/a>1.3 \u5728java\u4e2d\uff0c\u6253\u5370\u51fa\u6765\u7684OOP\u4fe1\u606f<\/h4>\n<p><img decoding=\"async\" class=\"lazyload\"data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-30\/20230714145330070793a5c.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" alt=\"image-20210714094603300\"><noscript><img decoding=\"async\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-30\/20230714145330070793a5c.png\" alt=\"image-20210714094603300\"><\/noscript><\/p>\n<p>\u5bf9\u8c61\u5934\u4fe1\u606f\uff0c\u5c31\u662fobject header\u4e2d\u7684\u4fe1\u606f\uff01<\/p>\n<h3><a id=\"2_203\"><\/a>2.\u5bf9\u8c61\u7684\u8bbf\u95ee\u5b9a\u4f4d<\/h3>\n<p>Java \u7a0b\u5e8f\u901a\u8fc7\u6808\u5e27\u4e2d\u5c40\u90e8\u53d8\u91cf\u8868\u4e2d\u7684 reference \u6570\u636e\u6765\u64cd\u4f5c\u5806\u4e0a\u7684\u5177\u4f53\u5bf9\u8c61\u3002<\/p>\n<p><img decoding=\"async\" class=\"lazyload\"data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-30\/202307141453300707fae57.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" alt=\"Image\"><noscript><img decoding=\"async\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-30\/202307141453300707fae57.png\" alt=\"Image\"><\/noscript><\/p>\n<p>\u7531\u4e8ereference\u7c7b\u578b\u5728Java\u865a\u62df\u673a\u89c4\u8303\u4e2d\u89c4\u5b9a\u4e86\u4e00\u4e2a\u6307\u5411\u5bf9\u8c61\u7684\u5f15\u7528\uff0c\u5e76\u6ca1\u6709\u5b9a\u4e49\u8fd9\u4e2a\u5f15\u7528\u5e94\u8be5\u901a\u8fc7\u4f55\u79cd\u65b9\u5f0f\u53bb\u5b9a\u4f4d\u3001\u8bbf\u95ee\u5806\u4e2d\u7684\u5bf9\u8c61\u7684\u5177\u4f53\u4f4d\u7f6e\uff0c\u6240\u4ee5\u5bf9\u8c61\u8bbf\u95ee\u65b9\u5f0f\u4e5f\u662f\u53d6\u51b3\u4e8e\u865a\u62df\u673a\u5b9e\u73b0\u800c\u5b9a\u7684\u3002<\/p>\n<p>\u76ee\u524d\u4e3b\u6d41\u7684\u8bbf\u95ee\u65b9\u5f0f\u6709\u4f7f\u7528<code>\u76f4\u63a5\u6307\u9488<\/code>\u548c<code>\u53e5\u67c4(\u4e86\u89e3\u5373\u53ef)<\/code>\u4e24\u79cd\uff1a<\/p>\n<h4><a id=\"21__213\"><\/a>2.1 \u76f4\u63a5\u6307\u9488<\/h4>\n<p>\u5982\u679c\u4f7f\u7528\u76f4\u63a5\u6307\u9488\u8bbf\u95ee\uff0c\u90a3\u4e48Java\u5806\u5bf9\u8c61\u7684\u5e03\u5c40\u4e2d\u5c31\u5fc5\u987b\u8003\u8651\u5982\u4f55\u653e\u7f6e\u7c7b\u578b\u6570\u636e\u7684\u76f8\u5173\u4fe1\u606f\uff08\u5bf9HotSpot\u865a\u62df\u673a\u800c\u8a00\uff0c\u4e5f\u5373\u5bf9\u8c61\u5934\u4e2d\u9700\u8981\u5b58\u653e<strong>\u7c7b\u578b\u6307\u9488<\/strong>\uff09\uff0c\u800creference\u4e2d\u5b58\u50a8\u7684\u76f4\u63a5\u5c31\u662f\u5bf9\u8c61\u5728\u5806\u4e2d\u7684\u5185\u5b58\u5730\u5740\u3002<\/p>\n<p><img decoding=\"async\" class=\"lazyload\"data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-30\/20230714145330f6f6481c8.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" alt=\"Image\"><noscript><img decoding=\"async\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-30\/20230714145330f6f6481c8.png\" alt=\"Image\"><\/noscript><\/p>\n<p>HotSpot\u865a\u62df\u673a\u5c31\u662f\u4f7f\u7528\u6b64\u79cd\u65b9\u5f0f\uff0c\u4f7f\u7528<strong>\u76f4\u63a5\u6307\u9488<\/strong>\u8bbf\u95ee\u65b9\u5f0f\u7684\u6700\u5927\u597d\u5904\u5c31\u662f\u901f\u66f4\u5feb\u3002<\/p>\n<h4><a id=\"22_221\"><\/a>2.2\u4f7f\u7528\u53e5\u67c4<\/h4>\n<p>\u5982\u679c\u4f7f\u7528\u53e5\u67c4\u8bbf\u95ee\uff0c\u90a3\u4e48Java\u5806\u4e2d\u5c06\u4f1a\u5212\u5206\u4e00\u5757\u5185\u5b58\u6765\u4f5c\u4e3a\u53e5\u67c4\u6c60\uff0creference\u4e2d\u5b58\u50a8\u7684\u5c31\u662f\u5bf9\u8c61\u7684\u53e5\u67c4\u5730\u5740\uff0c\u800c\u53e5\u67c4\u4e2d\u5305\u542b\u4e86\u5bf9\u8c61\u5b9e\u4f8b\u6570\u636e\u4e0e\u7c7b\u578b\u6570\u636e\u5404\u81ea\u7684\u5177\u4f53\u5730\u5740\u4fe1\u606f\u3002<\/p>\n<p><img decoding=\"async\" class=\"lazyload\"data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-31\/20230714145331555514c31.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" alt=\"Image\"><noscript><img decoding=\"async\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-31\/20230714145331555514c31.png\" alt=\"Image\"><\/noscript><\/p>\n<h3><a id=\"3_227\"><\/a>3.\u5bf9\u8c61\u7684\u521b\u5efa\u8fc7\u7a0b<\/h3>\n<p><img decoding=\"async\" class=\"lazyload\"data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-31\/20230714145331fbfb6ada8.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" alt=\"image-20210714121423657\"><noscript><img decoding=\"async\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-31\/20230714145331fbfb6ada8.png\" alt=\"image-20210714121423657\"><\/noscript><\/p>\n<p>\u8be5\u6d41\u7a0b\u56fe\u8be6\u7ec6\u89e3\u6790\uff1a<\/p>\n<p>\uff081\uff09new\u6307\u4ee4<\/p>\n<p>\u865a\u62df\u673a\u9047\u5230\u4e00\u6761new\u6307\u4ee4\u65f6\uff0c\u4f1a\u8fdb\u884c\u7c7b\u52a0\u8f7d\u68c0\u67e5<\/p>\n<p>\uff082\uff09\u7c7b\u52a0\u8f7d\u68c0\u67e5<\/p>\n<p><img decoding=\"async\" class=\"lazyload\"data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-31\/202307141453315858cf2ff.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" alt=\"Image\"><noscript><img decoding=\"async\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-31\/202307141453315858cf2ff.png\" alt=\"Image\"><\/noscript><\/p>\n<p>\u9996\u5148\u68c0\u67e5\u8fd9\u4e2a\u6307\u4ee4\u7684\u53c2\u6570\u80fd\u5426\u80fd\u5728\u5e38\u91cf\u6c60\u4e2d\u5b9a\u4f4d\u5230\u4e00\u4e2a\u7c7b\u7684\u7b26\u53f7\u5f15\u7528\uff0c\u5e76\u4e14\u68c0\u67e5\u8fd9\u4e2a\u7b26\u53f7\u5f15\u7528\u4ee3\u8868\u7684\u7c7b\u662f\u5426\u5df2\u88ab\u52a0\u8f7d\u3001\u89e3\u6790\u548c\u521d\u59cb\u5316\u8fc7\u3002\u5982\u679c\u6ca1\u6709\uff0c\u90a3\u5fc5\u987b\u5148\u6267\u884c\u76f8\u5e94\u7684\u7c7b\u52a0\u8f7d\u8fc7\u7a0b\u3002<\/p>\n<p>\uff083\uff09\u5bf9\u8c61\u5806\u5185\u5b58\u5206\u914d<\/p>\n<p>\u5728\u7c7b\u52a0\u8f7d\u68c0\u67e5\u901a\u8fc7\u540e\uff0c\u63a5\u4e0b\u6765\u865a\u62df\u673a\u5c06\u4e3a\u65b0\u751f\u5bf9\u8c61\u5206\u914d\u5185\u5b58\uff1b<\/p>\n<p>\u5bf9\u8c61\u6240\u9700\u5185\u5b58\u7684\u5927\u5c0f\u5728\u7c7b\u52a0\u8f7d\u5b8c\u6210\u540e\u4fbf\u53ef\u786e\u5b9a\uff0c\u4e3a\u5bf9\u8c61\u5206\u914d\u7a7a\u95f4\u7684\u4efb\u52a1\u7b49\u540c\u4e8e\u628a\u4e00\u5757\u786e\u5b9a\u5927\u5c0f\u7684\u5185\u5b58\u4eceJava\u5806\u4e2d\u5212\u5206\u51fa\u6765\u3002<\/p>\n<p>\u6709\u4e24\u79cd\u5185\u5b58\u5206\u914d\u65b9\u5f0f\uff1a<\/p>\n<p>\u6307\u9488\u78b0\u649e(\u6807\u8bb0\u6574\u7406-\u538b\u7f29)\uff1a\u8981\u6c42\u5806\u89c4\u6574\uff0c\u4e5f\u5373\u8981\u6c42\u5783\u573e\u6536\u96c6\u5668\u5e26\u6709\u538b\u7f29\u6574\u7406\u7684\u529f\u80fd\uff0c\u5177\u4f53\u6709 Serial\u3001ParNew<\/p>\n<p>\u7a7a\u95f2\u5217\u8868(\u6807\u8bb0\u6e05\u7406)\uff1a\u4e0d\u8981\u6c42\u5806\u89c4\u6574\uff0c\u50cfCMS\u8fd9\u79cd\u57fa\u4e8eMark-Sweep\u7b97\u6cd5\u7684\u6536\u96c6\u5668\uff0c\u901a\u5e38\u91c7\u7528\u7a7a\u95f2\u5217\u8868<\/p>\n<p>\u7ebf\u7a0b\u5b89\u5168\u95ee\u9898\u7684\u4e24\u79cd\u89e3\u51b3\u65b9\u6848\uff1a<\/p>\n<p>CAS+\u5931\u8d25\u91cd\u8bd5\uff1a\u5bf9\u5206\u914d\u5185\u5b58\u7a7a\u95f4\u7684\u52a8\u4f5c\u8fdb\u884c\u540c\u6b65\u5904\u7406\u2014\u2014\u5b9e\u9645\u4e0a\u865a\u62df\u673a\u91c7\u7528CAS\u914d\u4e0a\u5931\u8d25\u91cd\u8bd5\u7684\u65b9\u5f0f\u4fdd\u8bc1\u66f4\u65b0\u64cd\u4f5c\u7684\u539f\u5b50\u6027\u3002<\/p>\n<p>TLAB\uff1a\u5c06\u5185\u5b58\u5206\u914d\u7684\u52a8\u4f5c\u653e\u5728\u7ebf\u7a0b\u672c\u5730\u7a7a\u95f4\u4e2d\u8fdb\u884c\uff0c\u5373\u6bcf\u4e2a\u7ebf\u7a0b\u5728Java\u5806\u4e2d\u9884\u5148\u5206\u914d\u4e00\u5c0f\u5757\u5185\u5b58\uff0c\u79f0\u4e3a\u672c\u5730\u7ebf\u7a0b\u5206\u914d\u7f13\u51b2\uff08Thread Local Allocation Buffer\uff09\u3002\u54ea\u4e2a\u7ebf\u7a0b\u8981\u5206\u914d\u5185\u5b58\uff0c\u5c31\u5728\u54ea\u4e2a\u7ebf\u7a0b\u7684TLAB\u4e0a\u5206\u914d\uff0c\u53ea\u6709TLAB\u7528\u5b8c\u5e76\u5206\u914d\u65b0\u7684TLAB\u65f6\uff0c\u624d\u9700\u8981\u540c\u6b65\u9501\u5b9a\u3002<\/p>\n<p>\uff084\uff09\u521d\u59cb\u5316\u4e3a\u96f6\u503c<\/p>\n<p>\u5c06\u5bf9\u8c61\u5b9e\u4f8b\u6570\u636e\u521d\u59cb\u5316\u4e3a\u96f6\u503c\u3002<\/p>\n<p>\uff085\uff09\u5bf9\u8c61\u5934\u8bbe\u7f6e<\/p>\n<p>\u8bbe\u7f6e\u5bf9\u8c61\u5934\uff0c\u4f8b\u5982\u5982\u4f55\u624d\u80fd\u627e\u5230\u7c7b\u7684\u5143\u6570\u636e\u4fe1\u606f\uff08\u7c7b\u578b\u6307\u9488\uff09\u3001\u5bf9\u8c61\u7684\u54c8\u5e0c\u7801\uff08MarkWord\uff09\u3001\u5bf9\u8c61\u7684\u5206\u4ee3GC\u5e74\u9f84\uff08MarkWord\uff09\u3001\u662f\u5426\u542f\u7528\u504f\u5411\u9501\uff08MarkWord\uff09\u7b49<\/p>\n<p>\uff086\uff09\u6267\u884c\u65b9\u6cd5<\/p>\n<p>\u5373\u6267\u884c\u5bf9\u8c61\u7684\u6784\u9020\u65b9\u6cd5\u3002<\/p>\n<p><code> \u7b80\u5316<\/code>\u6574\u4e2a\u5bf9\u8c61\u521b\u5efa\u8fc7\u7a0b\u7684\u56fe\uff0c\u5408\u5e76\u4e86new\u6307\u4ee4\u3001\u68c0\u67e5\u89e3\u6790\u7b49\u8fc7\u7a0b\uff0c\u7528\u4e8e\u9762\u8bd5\u8bb2\u89e3\u7528(\u9762\u8bd5\u4e0d\u7528\u8bb2\u4e0a\u9762\u90a3\u4e48\u7ec6)\uff01<\/p>\n<p><img decoding=\"async\" class=\"lazyload\"data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-31\/202307141453316a6aa4f45.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" alt=\"Image\"><noscript><img decoding=\"async\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-31\/202307141453316a6aa4f45.png\" alt=\"Image\"><\/noscript><\/p>\n<blockquote><p>\u4e86\u89e3\u5bf9\u8c61\u7684\u521b\u5efa\u8fc7\u7a0b\uff0c\u80fd\u591f\u5904\u7406\uff0c\u7b2c\u4e00\uff0c\u4e0a\u56fe\u4e2d\u7684\u5404\u4e2a\u5730\u65b9\u7684\u4ee3\u7801\u6253\u5370\u987a\u5e8f\uff1b\u7b2c\u4e8c\uff0c\u4e5f\u80fd\u66f4\u52a0\u660e\u767d\u4e00\u4e2a\u5bf9\u8c61\u521b\u5efa\u7684\u65f6\u5019\u4f1a\u4e0d\u4f1a\u6709\u95ee\u9898\uff0c\u5728\u7f8e\u56e2\u7684\u4e00\u4e2a\u9762\u8bd5\u9898\u91cc\u9762\uff0c\u5c31\u6709\u4e00\u4e2a\u95ee\u9898\u662f\u521b\u5efaObject\u5bf9\u8c61\u4f1a\u53d1\u751f\u4ec0\u4e48\uff1f\u4e3a\u4ec0\u4e48DCL\u4e2d\u9700\u8981\u52a0volatile\uff1f<\/p><\/blockquote>\n<h2><a id=\"_279\"><\/a>\u4e09\u3001\u7c7b\u52a0\u8f7d\u673a\u5236<\/h2>\n<p>\u865a\u62df\u673a\u628a\u63cf\u8ff0\u7c7b\u7684\u6570\u636e\u4eceClass\u6587\u4ef6\u52a0\u8f7d\u5230\u5185\u5b58\uff0c\u5e76\u5bf9\u6570\u636e\u8fdb\u884c<strong>\u6821\u9a8c\u3001\u8f6c\u6362\u89e3\u6790\u548c\u521d\u59cb\u5316<\/strong>\uff0c\u6700\u7ec8\u5f62\u6210\u53ef\u4ee5\u88ab\u865a\u62df\u673a\u76f4\u63a5\u4f7f\u7528\u7684Java\u7c7b\u578b\uff0c\u8fd9\u5c31\u662f\u865a\u62df\u673a\u7684<strong>\u7c7b\u52a0\u8f7d\u673a\u5236<\/strong>\u3002<\/p>\n<p><img decoding=\"async\" class=\"lazyload\"data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-32\/202307141453324545d5b1d.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" alt=\"image-20210714153323958\"><noscript><img decoding=\"async\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-32\/202307141453324545d5b1d.png\" alt=\"image-20210714153323958\"><\/noscript><\/p>\n<h3><a id=\"1_285\"><\/a>1.\u7c7b\u7684\u751f\u547d\u5468\u671f<\/h3>\n<p><img decoding=\"async\" class=\"lazyload\"data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-32\/20230714145332cbcb5b68d.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" alt=\"Image\"><noscript><img decoding=\"async\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-32\/20230714145332cbcb5b68d.png\" alt=\"Image\"><\/noscript><\/p>\n<p>\u7c7b\u7684\u6574\u4e2a\u751f\u547d\u5468\u671f\u5305\u62ec7\u4e2a\u9636\u6bb5\uff1a\u52a0\u8f7d\u3001\u9a8c\u8bc1\u3001\u51c6\u5907\u3001\u89e3\u6790\u3001\u521d\u59cb\u5316\u3001\u4f7f\u7528\u548c\u5378\u8f7d\uff0c\u5176\u4e2d\u9a8c\u8bc1\u3001\u51c6\u5907\u3001\u89e3\u67903\u4e2a\u90e8\u5206\u7edf\u79f0\u4e3a\u8fde\u63a5\u3002<\/p>\n<h3><a id=\"2_291\"><\/a>2.\u7c7b\u52a0\u8f7d\u7684\u65f6\u673a(\u4e86\u89e3\u5373\u53ef)<\/h3>\n<p>\u865a\u62df\u673a\u89c4\u8303\u4e25\u683c\u89c4\u5b9a\u4e86\u6709\u4e14\u53ea\u67095\u79cd\u60c5\u51b5\u5fc5\u987b\u7acb\u5373\u5bf9\u7c7b\u8fdb\u884c\u201c\u521d\u59cb\u5316\u201c\uff08\u800c\u52a0\u8f7d\u3001\u9a8c\u8bc1\u3001\u51c6\u5907\u81ea\u7136\u9700\u8981\u5728\u6b64\u4e4b\u524d\u5f00\u59cb\uff09\uff1a<\/p>\n<p>\uff081\uff09\u9047\u5230 new\u3001getstatic\u3001putstatic \u6216 invokestatic \u8fd94\u6761\u5b57\u8282\u7801\u6307\u4ee4\u65f6\uff0c\u5982\u679c\u7c7b\u6ca1\u6709\u8fdb\u884c\u8fc7\u521d\u59cb\u5316\uff0c\u5219\u9700\u8981\u5148\u89e6\u53d1\u5176\u521d\u59cb\u5316\u3002<\/p>\n<p>\uff082\uff09\u4f7f\u7528 java.lang.reflect \u5305\u7684\u65b9\u6cd5\u5bf9\u7c7b\u8fdb\u884c\u53cd\u5c04\u8c03\u7528\u7684\u65f6\u5019\uff0c\u5982\u679c\u7c7b\u6ca1\u6709\u8fdb\u884c\u8fc7\u521d\u59cb\u5316\uff0c\u5219\u9700\u8981\u5148\u89e6\u53d1\u5176\u521d\u59cb\u5316\u3002<\/p>\n<p>\uff083\uff09\u5f53\u521d\u59cb\u5316\u4e00\u4e2a\u7c7b\u7684\u65f6\u5019\uff0c\u5982\u679c\u53d1\u73b0\u5176\u7236\u7c7b\u8fd8\u6ca1\u6709\u8fdb\u884c\u8fc7\u521d\u59cb\u5316\uff0c\u5219\u9700\u8981\u5148\u89e6\u53d1\u5176\u7236\u7c7b\u7684\u521d\u59cb\u5316\u3002<\/p>\n<p>\uff084\uff09\u5f53\u865a\u62df\u673a\u542f\u52a8\u65f6\uff0c\u7528\u6237\u9700\u8981\u6307\u5b9a\u4e00\u4e2a\u8981\u6267\u884c\u7684\u4e3b\u7c7b\uff08\u5305\u542bmain() \u65b9\u6cd5\u7684\u90a3\u4e2a\u7c7b\uff09\uff0c\u865a\u62df\u673a\u4f1a\u5148\u521d\u59cb\u5316\u8fd9\u4e2a\u4e3b\u7c7b\u3002<\/p>\n<p>\uff085\uff09\u5f53\u4f7f\u7528JDK 1.7\u7684\u52a8\u6001\u8bed\u8a00\u652f\u6301\u65f6\uff0c\u5982\u679c\u4e00\u4e2a java.lang.invoke.MethodHandle \u5b9e\u4f8b\u6700\u540e\u7684\u89e3\u6790\u7ed3\u679c REF_getStatic\u3001REF_putStatic\u3001REF_invokeStatic\u7684\u65b9\u6cd5\u53e5\u67c4\uff0c\u5e76\u4e14\u8fd9\u4e2a\u65b9\u6cd5\u53e5\u67c4\u6240\u5bf9\u5e94\u7684\u7c7b\u6ca1\u6709\u8fdb\u884c\u8fc7\u521d\u59cb\u5316\uff0c\u5219\u9700\u8981\u5148\u89e6\u53d1\u5176\u521d\u59cb\u5316\u3002<\/p>\n<h3><a id=\"3_305\"><\/a>3.\u7c7b\u52a0\u8f7d\u8fc7\u7a0b<\/h3>\n<h4><a id=\"31__307\"><\/a>3.1 \u52a0\u8f7d<\/h4>\n<p>\u5728\u52a0\u8f7d\u9636\u6bb5\uff0c\u865a\u62df\u673a\u9700\u8981\u5b8c\u6210\u4ee5\u4e0b3\u4ef6\u4e8b\u60c5\uff1a<br \/>\n1\uff09\u901a\u8fc7\u4e00\u4e2a\u7c7b\u7684\u5168\u9650\u5b9a\u540d\u6765\u83b7\u53d6\u5b9a\u4e49\u6b64\u7c7b\u7684\u4e8c\u8fdb\u5236\u5b57\u8282\u6d41\u3002<\/p>\n<p>2\uff09\u5c06\u8fd9\u4e2a\u5b57\u8282\u6d41\u6240\u4ee3\u8868\u7684\u9759\u6001\u5b58\u50a8\u7ed3\u6784\u8f6c\u5316\u4e3a\u65b9\u6cd5\u533a\u7684\u8fd0\u884c\u65f6\u6570\u636e\u7ed3\u6784\u3002<\/p>\n<p>3\uff09\u5728\u5185\u5b58\u4e2d\u751f\u6210\u4e00\u4e2a\u4ee3\u8868\u8fd9\u4e2a\u7c7b\u7684 java.lang.Class\u5bf9\u8c61\uff08\u5b58\u5728\u65b9\u6cd5\u533a\uff09\uff0c\u4f5c\u4e3a\u65b9\u6cd5\u533a\u8fd9\u4e2a\u7c7b\u7684\u5404\u79cd\u6570\u636e\u7684\u8bbf\u95ee\u5165\u53e3\u3002<br \/>\n\u52a0\u8f7d\u4e0e\u8fde\u63a5\u9636\u6bb5\u7684\u90e8\u5206\u5185\u5bb9\u662f\u4ea4\u53c9\u8fdb\u884c\u7684\uff0c\u8fd9\u4e24\u4e2a\u9636\u6bb5\u7684\u5f00\u59cb\u65f6\u95f4\u4fdd\u6301\u56fa\u5b9a\u7684\u5148\u540e\u987a\u5e8f<\/p>\n<h4><a id=\"32__317\"><\/a>3.2 \u9a8c\u8bc1<\/h4>\n<p>\u9a8c\u8bc1\u7684\u76ee\u7684\u662f\uff1a\u4e3a\u4e86\u786e\u4fdd Class \u6587\u4ef6\u7684\u5b57\u8282\u6d41\u4e2d\u5305\u542b\u7684\u4fe1\u606f\u7b26\u5408\u5f53\u524d\u865a\u62df\u673a\u7684\u8981\u6c42\uff0c\u5e76\u4e14\u4e0d\u4f1a\u5371\u5bb3\u865a\u62df\u673a\u81ea\u8eab\u7684\u5b89\u5168\u3002<br \/>\n\u4e3b\u8981\u8fdb\u884c\u5982\u4e0b\u9a8c\u8bc1\u52a8\u4f5c\uff1a\u6587\u4ef6\u683c\u5f0f\u9a8c\u8bc1\u3001\u5143\u6570\u636e\u9a8c\u8bc1\u3001\u5b57\u8282\u7801\u9a8c\u8bc1\u3001\u7b26\u53f7\u5f15\u7528\u9a8c\u8bc1\u3002<\/p>\n<h4><a id=\"33__322\"><\/a>3.3 \u51c6\u5907<\/h4>\n<p>\u5728\u65b9\u6cd5\u533a\u4e2d\uff0c\u4e3a\u7c7b\u53d8\u91cf\u5206\u914d\u5185\u5b58\uff0c\u5e76\u8bbe\u7f6e\u7c7b\u53d8\u91cf\u521d\u59cb\u96f6\u503c\u3002<\/p>\n<h4><a id=\"34__326\"><\/a>3.4 \u89e3\u6790<\/h4>\n<p>\u89e3\u6790\u9636\u6bb5\u662f\u865a\u62df\u673a\u5c06\u5e38\u91cf\u6c60\u5185\u7684\u7b26\u53f7\u5f15\u7528\u66ff\u6362\u4e3a\u76f4\u63a5\u5f15\u7528\u7684\u8fc7\u7a0b\u3002<\/p>\n<p>\u7b26\u53f7\u5f15\u7528\uff1a\u5982\u5168\u7c7b\u540d\u3001\u5b57\u6bb5\u63cf\u8ff0\u7b26\u3001\u65b9\u6cd5\u63cf\u8ff0\u7b26\u3002<\/p>\n<p>\u76f4\u63a5\u5f15\u7528\uff1a\u76f4\u63a5\u6307\u5411\u76ee\u6807\u7684\u6307\u9488\u3001\u76f8\u5bf9\u504f\u79fb\u91cf\u6216\u662f\u4e00\u4e2a\u80fd\u95f4\u63a5\u5b9a\u4f4d\u5230\u76ee\u6807\u7684\u53e5\u67c4\u3002<\/p>\n<p>\u89e3\u6790\u52a8\u4f5c\u4e3b\u8981\u9488\u5bf9\u7c7b\u6216\u63a5\u53e3\u3001\u5b57\u6bb5\u3001\u7c7b\u65b9\u6cd5\u3001\u63a5\u53e3\u65b9\u6cd5\u3001\u65b9\u6cd5\u7c7b\u578b\u3001\u65b9\u6cd5\u53e5\u67c4\u548c\u8c03\u7528\u70b9\u9650\u5b9a\u7b267\u7c7b\u7b26\u53f7\u5f15\u7528\u8fdb\u3002<\/p>\n<h4><a id=\"35__336\"><\/a>3.5 \u521d\u59cb\u5316<\/h4>\n<p>\u521d\u59cb\u5316\u9636\u6bb5\u662f\u6267\u884c\u7c7b\u6784\u9020\u5668()\u65b9\u6cd5\u7684\u8fc7\u7a0b\u3002<\/p>\n<p>()\u65b9\u6cd5\u662f\u7531\u7f16\u8bd1\u5668\u81ea\u52a8\u6536\u96c6\u7c7b\u4e2d\u7684\u6240\u6709 \u7c7b\u53d8\u91cf\u7684\u8d4b\u503c\u52a8\u4f5c\u548c\u9759\u6001\u8bed\u53e5\u5757\uff08static{}\uff09\u4e2d\u7684\u8bed\u53e5\u5408\u5e76\u4ea7\u751f\u7684\uff0c\u7f16\u8bd1\u5668\u6536\u96c6\u7684\u987a\u5e8f\u662f\u7531\u8bed\u53e5\u5728\u6e90\u6587\u4ef6\u4e2d\u51fa\u73b0\u7684\u987a\u5e8f\u6240\u51b3\u5b9a\u7684\uff0c\u9759\u6001\u8bed\u53e5\u5757\u4e2d\u53ea\u80fd\u8bbf\u95ee\u5230\u5b9a\u4e49\u5728\u9759\u6001\u8bed\u53e5\u5757\u4e4b\u524d\u7684\u53d8\u91cf\uff0c\u5b9a\u4e49\u5728\u5b83\u4e4b\u540e\u7684\u53d8\u91cf\uff0c\u5728\u524d\u9762\u7684\u9759\u6001\u8bed\u53e5\u5757\u53ef\u4ee5\u8d4b\u503c\uff0c\u4f46\u662f\u4e0d\u80fd\u8bbf\u95ee\u3002\u865a\u62df\u673a\u4f1a\u4fdd\u8bc1\u5728\u5b50\u7c7b\u7684 () \u65b9\u6cd5\u6267\u884c\u4e4b\u524d\uff0c\u7236\u7c7b\u7684() \u65b9\u6cd5\u5df2\u7ecf\u6267\u884c\u5b8c\u6bd5\u3002<\/p>\n<h3><a id=\"4_342\"><\/a>4.\u7c7b\u52a0\u8f7d\u5668\u7684\u53cc\u4eb2\u59d4\u6d3e\u6a21\u578b<\/h3>\n<p><img decoding=\"async\" class=\"lazyload\"data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-32\/202307141453327e7e55f13.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" alt=\"Image\"><noscript><img decoding=\"async\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-32\/202307141453327e7e55f13.png\" alt=\"Image\"><\/noscript><\/p>\n<p>\u53cc\u4eb2\u59d4\u6d3e\u6a21\u578b\u7684\u5de5\u4f5c\u8fc7\u7a0b\u662f\uff1a<\/p>\n<p>\u5982\u679c\u4e00\u4e2a\u7c7b\u52a0\u8f7d\u5668\u6536\u5230\u4e86\u7c7b\u52a0\u8f7d\u7684\u8bf7\u6c42\uff0c\u5b83\u9996\u5148\u4e0d\u4f1a\u81ea\u5df1\u53bb\u5c1d\u8bd5\u52a0\u8f7d\u8fd9\u4e2a\u7c7b\uff0c\u800c\u662f\u628a\u8fd9\u4e2a\u8bf7\u6c42\u59d4\u6d3e\u7ed9\u7236\u7c7b\u52a0\u8f7d\u5668\u53bb\u5b8c\u6210\uff0c\u6bcf\u4e00\u4e2a\u5c42\u6b21\u7684\u7c7b\u52a0\u8f7d\u5668\u90fd\u662f\u5982\u6b64\uff0c\u56e0\u6b64\u6240\u6709\u7684\u52a0\u8f7d\u8bf7\u6c42\u6700\u7ec8\u90fd\u5e94\u8be5\u4f20\u9001\u5230\u9876\u5c42\u7684\u542f\u52a8\u7c7b\u52a0\u8f7d\u5668\u4e2d\uff0c\u53ea\u6709\u5f53\u7236\u52a0\u8f7d\u5668\u53cd\u9988\u81ea\u5df1\u65e0\u6cd5\u5b8c\u6210\u8fd9\u4e2a\u52a0\u8f7d\u8bf7\u6c42\uff08\u5b83\u7684\u641c\u7d22\u8303\u56f4\u4e2d\u6ca1\u6709\u627e\u5230\u6240\u9700\u7684\u7c7b\uff09\u65f6\uff0c\u5b50\u52a0\u8f7d\u5668\u624d\u4f1a\u5c1d\u8bd5\u81ea\u5df1\u53bb\u52a0\u8f7d\u3002<\/p>\n<p>\u989d\u5916\u81ea\u5df1\u7814\u7a76\u8d44\u6599\uff1ahttps:\/\/app.yinxiang.com\/fx\/e5892df0-7ff4-4df0-8bc5-516806d40275<\/p>\n<h2><a id=\"_352\"><\/a>\u56db\u3001\u5783\u573e\u56de\u6536\u673a\u5236<\/h2>\n<blockquote><p>\u6838\u5fc3\u8bcd\u8bed\uff1aSTW\uff0cstop the world\uff01<\/p><\/blockquote>\n<h3><a id=\"1_356\"><\/a>1.\u5bf9\u8c61\u5b58\u6d3b\u5224\u5b9a\u7b97\u6cd5<\/h3>\n<h4><a id=\"11__358\"><\/a>1.1 \u5f15\u7528\u8ba1\u6570\u6cd5<\/h4>\n<p>\u7ed9\u5bf9\u8c61\u4e2d\u6dfb\u52a0\u4e00\u4e2a\u5f15\u7528\u8ba1\u6570\u5668\uff0c\u6bcf\u5f53\u6709\u4e00\u4e2a\u5730\u65b9\u5f15\u7528\u5b83\u65f6\uff0c\u8ba1\u6570\u5668\u503c\u5c31\u52a01\uff1b\u5f53\u5f15\u7528\u5931\u6548\u65f6\uff0c\u8ba1\u6570\u5668\u503c\u5c31\u51cf1\uff1b\u4efb\u4f55\u65f6\u523b\u8ba1\u6570\u5668\u4e3a0\u7684\u5bf9\u8c61\u5c31\u662f\u4e0d\u53ef\u80fd\u518d\u88ab\u4f7f\u7528\u3002<\/p>\n<p>\u5f15\u7528\u8ba1\u6570\u6cd5\u5224\u5b9a\u6548\u7387\u9ad8\uff0c\u4f46\u5f88\u96be\u89e3\u51b3\u5bf9\u8c61\u4e4b\u95f4\u76f8\u4e92\u5faa\u73af\u5f15\u7528\u7684\u95ee\u9898(\u4e0d\u8fc7JVM\u662f\u4f7f\u7528\u7684\u6839\u53ef\u8fbe\u7b97\u6cd5\u89e3\u51b3\u7684)\u3002<\/p>\n<h4><a id=\"12__364\"><\/a>1.2 \u53ef\u8fbe\u6027\u5206\u6790\u6cd5<\/h4>\n<p><img decoding=\"async\" class=\"lazyload\"data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-33\/202307141453338585dc4b0.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" alt=\"image-20210714171657144\"><noscript><img decoding=\"async\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-33\/202307141453338585dc4b0.png\" alt=\"image-20210714171657144\"><\/noscript><\/p>\n<p>\u901a\u8fc7\u4e00\u7cfb\u5217\u7684\u79f0\u4e3aGC Roots\u7684\u5bf9\u8c61\u4f5c\u4e3a\u8d77\u59cb\u70b9\uff0c\u4ece\u8fd9\u4e9b\u8282\u70b9\u5f00\u59cb\u5411\u4e0b\u641c\u7d22\uff0c\u641c\u7d22\u6240\u8d70\u8fc7\u7684\u8def\u5f84\u79f0\u4e3a\u5f15\u7528\u94fe\uff08Reference Chain\uff09\uff0c\u5f53\u4e00\u4e2a\u5bf9\u8c61\u5230 GC Roots\u6ca1\u6709\u4efb\u4f55\u5f15\u7528\u94fe\u76f8\u8fde\u65f6\uff0c\u5219\u8bc1\u660e\u6b64\u5bf9\u8c61\u662f\u4e0d\u53ef\u7528\u7684\u3002<\/p>\n<p>\u5f15\u7528\uff1a<br \/>\n\u5f3a\u5f15\u7528\uff1a\u4e0d\u56de\u6536<br \/>\n\u8f6f\u5f15\u7528\uff1a\u5185\u5b58\u6ea2\u51fa\u524d\u56de\u6536<br \/>\n\u5f31\u5f15\u7528\uff1a\u4e0b\u4e00\u6b21\u5783\u573e\u6536\u96c6\u65f6\u56de\u6536<\/p>\n<blockquote><p>\u53ef\u4ee5\u4f5c\u4e3aGC roots\u6839\u8282\u70b9: \u7c7b\u52a0\u8f7d\u5668\uff0cThread\uff0c\u865a\u62df\u673a\u6808\u7684\u672c\u5730\u53d8\u91cf\u8868\uff0cstatic\u6210\u5458\uff0c\u5e38\u91cf\u5f15\u7528\uff0c\u672c\u5730\u65b9\u6cd5\u6808\u7684\u53d8\u91cf\u7b49\u3002<\/p><\/blockquote>\n<h3><a id=\"2_377\"><\/a>2.\u5783\u573e\u6536\u96c6\u7b97\u6cd5<\/h3>\n<h4><a id=\"21_379\"><\/a>2.1\u6807\u8bb0-\u6e05\u7406<\/h4>\n<h4><a id=\"22_381\"><\/a>2.2\u6807\u8bb0-\u6574\u7406(\u538b\u7f29\u4e5f\u884c)<\/h4>\n<h4><a id=\"23_383\"><\/a>2.3\u590d\u5236\u7b97\u6cd5<\/h4>\n<h4><a id=\"24__385\"><\/a>2.4 \u5206\u4ee3\u6536\u96c6\u7b97\u6cd5<\/h4>\n<p>\u975e\u6807\u51c6\u7b97\u6cd5\uff0c\u662fJVM\u5185\u5b58\u7684GC\u56de\u6536\u65b9\u6848\uff0c\u5185\u90e8\u5305\u542b\u4e862.1 \u52302.3 3\u79cd\u7b97\u6cd5\u3002<\/p>\n<h3><a id=\"3_389\"><\/a>3.\u5185\u5b58\u5206\u914d\u4e0e\u56de\u6536\u7b56\u7565<\/h3>\n<h4><a id=\"31__391\"><\/a>3.1 \u5185\u5b58\u5206\u914d\u4e0e\u56de\u6536\u7b56\u7565<\/h4>\n<p>\u5bf9\u8c61\u7684\u5185\u5b58\u5206\u914d\uff0c\u5f80\u5927\u65b9\u5411\u8bb2\uff0c\u5c31\u662f\u5728\u5806\u4e0a\u5206\u914d\uff08\u4f8b\u5916\uff1a\u9003\u9038\u5206\u6790\uff09\u3002<\/p>\n<p>\u540c\u65f6\u8fd8\u9700\u8bb0\u4f4f\u4e00\u70b9\uff1a\u5206\u914d\u7684\u89c4\u5219\u5e76\u4e0d\u662f\u767e\u5206\u4e4b\u767e\u56fa\u5b9a\u7684\uff0c\u5176\u7ec6\u8282\u53d6\u51b3\u4e8e\u5f53\u524d\u4f7f\u7528\u7684\u662f\u54ea\u4e00\u79cd<code>\u5783\u573e\u6536\u96c6\u5668\u7ec4\u5408<\/code>\uff0c\u8fd8\u6709\u865a\u62df\u673a\u4e2d\u4e0e\u5185\u5b58\u76f8\u5173\u7684\u53c2\u6570\u7684\u8bbe\u7f6e\u3002<\/p>\n<p>\uff081\uff09\u5bf9\u8c61\u4f18\u5148\u5728 TLAB \u4e0a\u5206\u914d<\/p>\n<p>Thread Local Allocation Buffer\uff0c\u5373\u7ebf\u7a0b\u672c\u5730\u5206\u914d\u7f13\u5b58\u533a\uff0c\u5982\u679c\u542f\u52a8\u4e86\u672c\u5730\u7ebf\u7a0b\u5206\u914d\u7f13\u51b2\uff0c\u5c06\u6309\u7ebf\u7a0b\u4f18\u5148\u5728 TLAB \u4e0a\u5206\u914d\u3002<\/p>\n<p>\uff082\uff09\u5bf9\u8c61\u4f18\u5148\u5728Eden\u5206\u914d<\/p>\n<p>\u5927\u591a\u6570\u60c5\u51b5\u4e0b\uff0c\u5bf9\u8c61\u5728\u65b0\u751f\u4ee3Eden\u533a\u4e2d\u5206\u914d\u3002\u5f53Eden\u533a\u6ca1\u6709\u8db3\u591f\u7a7a\u95f4\u8fdb\u884c\u5206\u914d\u65f6\uff0c\u865a\u62df\u673a\u5c06\u53d1\u8d77\u4e00\u6b21MinorGC\u3002<\/p>\n<p>\uff083\uff09\u5927\u5bf9\u8c61\u76f4\u63a5\u8fdb\u5165\u8001\u5e74\u4ee3<\/p>\n<p>\u865a\u62df\u673a\u63d0\u4f9b\u4e86\u4e00\u4e2a-XX\uff1aPretenureSizeThreshold\u53c2\u6570\uff0c\u4ee4\u5927\u4e8e\u8fd9\u4e2a\u8bbe\u7f6e\u503c\u7684\u5bf9\u8c61\u76f4\u63a5\u5728\u8001\u5e74\u4ee3\u5206\u914d\u3002\u8fd9\u6837\u505a\u7684\u76ee\u7684\u662f\u907f\u514d\u5728Eden\u533a\u53ca\u4e24\u4e2aSurvivor\u533a\u4e4b\u95f4\u53d1\u751f\u5927\u91cf\u7684\u5185\u5b58\u590d\u5236\u3002<\/p>\n<p>\uff084\uff09\u957f\u671f\u5b58\u6d3b\u7684\u5bf9\u8c61\u8fdb\u5165\u8001\u5e74\u4ee3<\/p>\n<p>\u5e74\u9f84\u8ba1\u6570\uff1a\u865a\u62df\u673a\u7ed9\u6bcf\u4e2a\u5bf9\u8c61\u5b9a\u4e49\u4e86\u4e00\u4e2a\u5bf9\u8c61\u5e74\u9f84\uff08Age\uff09\u8ba1\u6570\u5668\uff0c\u5bf9\u8c61\u6bcf\u7ecf\u5386\u4e00\u6b21Minor GC \uff0c\u5e74\u9f84\u5c31\u52a01\uff0c\u5f53\u5b83\u7684\u5e74\u9f84\u589e\u52a0\u5230\u4e00\u5b9a\u7a0b\u5ea6\uff08\u9ed8\u8ba4\u4e3a15\u5c81\uff0c\u800c\u4e14\u4e0d\u80fd\u8d85\u8fc715\uff09\uff0c\u5c31\u5c06\u4f1a\u88ab\u664b\u5347\u5230\u8001\u5e74\u4ee3\u4e2d\u3002\u5e74\u9f84\u9608\u503c\uff1a\u5bf9\u8c61\u664b\u5347\u8001\u5e74\u4ee3\u7684\u5e74\u9f84\u9608\u503c\uff0c\u53ef\u4ee5\u901a\u8fc7\u53c2\u6570-XX\uff1aMaxTenuringThreshold\u8bbe\u7f6e\u3002\u52a8\u6001\u5bf9\u8c61\u5e74\u9f84\u5224\u5b9a\uff1a\u5982\u679c\u5728Survivor\u7a7a\u95f4\u4e2d\u76f8\u540c\u5e74\u9f84\u6240\u6709\u5bf9\u8c61\u5927\u5c0f\u7684\u603b\u548c\u5927\u4e8eSurvivor\u7a7a\u95f4\u7684\u4e00\u534a\uff0c\u5e74\u9f84\u5927\u4e8e\u6216\u7b49\u4e8e\u8be5\u5e74\u9f84\u7684\u5bf9\u8c61\u5c31\u53ef\u4ee5\u76f4\u63a5\u8fdb\u5165\u8001\u5e74\u4ee3\uff0c\u65e0\u987b\u7b49\u5230MaxTenuringThreshold\u4e2d\u8981\u6c42\u7684\u5e74\u9f84\u3002<\/p>\n<p>\uff085\uff09\u7a7a\u95f4\u5206\u914d\u62c5\u4fdd<\/p>\n<p>Minor GC\u5728\u53d1\u751f\u4e4b\u524d\uff0c\u865a\u62df\u673a\u4f1a\u5148\u68c0\u67e5\u8001\u5e74\u4ee3\u6700\u5927\u53ef\u7528\u7684\u8fde\u7eed\u7a7a\u95f4\u662f\u5426\u5927\u4e8e\u65b0\u751f\u4ee3\u6240\u6709\u5bf9\u8c61\u603b\u7a7a\u95f4\uff1b<\/p>\n<p>\u5982\u679c\u5927\u4e8e\uff0c\u90a3\u4e48Minor GC \u53ef\u4ee5\u786e\u4fdd\u662f\u5b89\u5168\u7684\u3002\u5982\u679c\u4e0d\u6210\u7acb\uff0c\u5219\u865a\u62df\u673a\u4f1a \u67e5\u770b HandlePromotionFailure \u8bbe\u7f6e\u503c\u662f\u5426\u5141\u8bb8\u62c5\u4fdd\u5931\u8d25\u3002\u5982\u679c\u5141\u8bb8\uff0c\u90a3\u4e48\u4f1a\u7ee7\u7eed\u68c0\u67e5\u8001\u5e74\u4ee3\u6700\u5927\u53ef\u7528\u7684\u8fde\u7eed\u7a7a\u95f4\u662f\u5426\u5927\u4e8e\u5386\u6b21\u664b\u5347\u5230\u8001\u5e74\u4ee3\u5bf9\u8c61\u7684\u5e73\u5747\u5927\u5c0f\uff0c\u5982\u679c\u5927\u4e8e\uff0c\u5c06\u5c1d\u8bd5\u7740\u8fdb\u884c\u4e00\u6b21Minor GC\uff0c\u5c3d\u7ba1\u8fd9\u6b21Minor GC\u662f\u6709\u98ce\u9669\u7684\uff1b\u5982\u679c\u5c0f\u4e8e\uff0c\u6216\u8005HandlePromotionFailure\u8bbe\u7f6e\u4e0d\u5141\u8bb8\u5192\u9669\uff0c\u90a3\u8fd9\u65f6\u4e5f\u8981\u6539\u4e3a\u8fdb\u884c\u4e00\u6b21Full GC\u4e5f\u5c31\u662f\u8bf4\uff0c\u5982\u679cMinor GC\u4e0d\u5b89\u5168\uff0c\u865a\u62df\u673a\u5c31\u8fdb\u884c Full GC\u3002<\/p>\n<h4><a id=\"32_Minor_GC__Full_GC__419\"><\/a>3.2 Minor GC \u4e0e Full GC \u89e6\u53d1\u6761\u4ef6<\/h4>\n<p>\u65b0\u751f\u4ee3GC\uff08Minor GC\uff09\uff1a\u53d1\u751f\u5728\u65b0\u751f\u4ee3\u7684\u5783\u573e\u6536\u96c6\u52a8\u4f5c\u3002\u56e0\u4e3aJava\u5bf9\u8c61\u5927\u591a\u90fd\u5177\u5907\u671d\u751f\u5915\u706d\u7684\u7279\u6027\uff0c\u6240\u4ee5Minor GC\u975e\u5e38\u9891\u7e41\uff0c\u4e00\u822c\u56de\u6536\u901f\u5ea6\u4e5f\u6bd4\u8f83\u5feb\u3002<\/p>\n<p>\u8001\u5e74\u4ee3GC\uff08Major GC\/Full GC\uff09\uff1a\u6307\u53d1\u751f\u5728\u8001\u5e74\u4ee3\u7684GC\uff0c\u51fa\u73b0\u4e86Major GC\uff0c\u7ecf\u5e38\u4f1a\u4f34\u968f\u81f3\u5c11\u4e00\u6b21\u7684Minor GC\uff08\u4f46\u975e\u7edd\u5bf9\u7684\uff0c\u5728Parallel Scavenge\u6536\u96c6\u5668\u7684\u6536\u96c6\u7b56\u7565\u91cc\u5c31\u6709\u76f4\u63a5\u8fdb\u884cMajor GC\u7684\u7b56\u7565\u9009\u62e9\u8fc7\u7a0b\uff09\u3002<\/p>\n<p>Major GC\u7684\u901f\u5ea6\u4e00\u822c\u4f1a\u6bd4Minor GC\u616210\u500d\u4ee5\u4e0a\u3002<\/p>\n<p>\u53c2\u8003\uff1aMinor GC \uff0cFull GC \u89e6\u53d1\u6761\u4ef6\u662f\u4ec0\u4e48\uff1f<\/p>\n<p>Full GC\u89e6\u53d1\u6761\u4ef6\uff1a<\/p>\n<p>\uff081\uff09System.gc()\u65b9\u6cd5\u7684\u8c03\u7528<br \/>\n\uff082\uff09\u8001\u5e74\u4ee3\u7a7a\u95f4\u4e0d\u8db3<br \/>\n\uff083\uff09\u65b9\u6cd5\u533a\u7a7a\u95f4\u4e0d\u8db3<br \/>\n\uff084\uff09\u901a\u8fc7Minor GC\u540e\u8fdb\u5165\u8001\u5e74\u4ee3\u7684\u5e73\u5747\u5927\u5c0f\u5927\u4e8e\u8001\u5e74\u4ee3\u7684\u53ef\u7528\u5185\u5b58<br \/>\n\uff085\uff09\u7531Eden\u533a\u3001From Space\u533a\u5411To Space\u533a\u590d\u5236\u65f6\uff0c\u5bf9\u8c61\u5927\u5c0f\u5927\u4e8eTo Space\u53ef\u7528\u5185\u5b58\uff0c\u5219\u628a\u8be5\u5bf9\u8c61\u8f6c\u5b58\u5230\u8001\u5e74\u4ee3\uff0c\u4e14\u8001\u5e74\u4ee3\u7684\u53ef\u7528\u5185\u5b58\u5c0f\u4e8e\u8be5\u5bf9\u8c61\u5927\u5c0f\u3002<\/p>\n<h2><a id=\"_437\"><\/a>\u4e94\u3001\u5783\u573e\u6536\u96c6\u5668<\/h2>\n<blockquote><p>\u5982\u679c\u8bf4\u6536\u96c6\u7b97\u6cd5\u662f\u5185\u5b58\u56de\u6536\u7684\u65b9\u6cd5\u8bba\uff0c\u5783\u573e\u6536\u96c6\u5668\u5c31\u662f\u5185\u5b58\u56de\u6536\u7684\u5177\u4f53\u5b9e\u73b0\u3002<\/p><\/blockquote>\n<h3><a id=\"1_Serial_441\"><\/a>1. Serial\u6536\u96c6\u5668<\/h3>\n<p>\u4e32\u884c\u6536\u96c6\u5668\u662f\u6700\u53e4\u8001\uff0c\u6700\u7a33\u5b9a\u4ee5\u53ca\u6548\u7387\u9ad8\u7684\u6536\u96c6\u5668\uff0c\u53ef\u80fd\u4f1a\u4ea7\u751f\u8f83\u957f\u7684\u505c\u987f\uff0c\u53ea\u4f7f\u7528<strong>\u4e00\u4e2a\u7ebf\u7a0b<\/strong>\u53bb\u56de\u6536\u3002\u65b0\u751f\u4ee3\u3001\u8001\u5e74\u4ee3\u4f7f\u7528<strong>\u4e32\u884c<\/strong>\u56de\u6536\uff1b<strong>\u65b0\u751f\u4ee3\u590d\u5236\u7b97\u6cd5<\/strong>\u3001<strong>\u8001\u5e74\u4ee3\u6807\u8bb0-\u538b\u7f29<\/strong>\uff1b\u5783\u573e\u6536\u96c6\u7684\u8fc7\u7a0b\u4e2d\u4f1aStop The World\uff08\u670d\u52a1\u6682\u505c\uff09<\/p>\n<p>\u53c2\u6570\u63a7\u5236\uff1a<strong>-XX:+UseSerialGC<\/strong> \u4e32\u884c\u6536\u96c6\u5668<\/p>\n<p><img decoding=\"async\" class=\"lazyload\"data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-33\/202307141453330d0d681c3.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" alt=\"Image\"><noscript><img decoding=\"async\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-33\/202307141453330d0d681c3.png\" alt=\"Image\"><\/noscript><\/p>\n<h3><a id=\"2_ParNew_449\"><\/a>2. ParNew\u6536\u96c6\u5668<\/h3>\n<p>ParNew\u6536\u96c6\u5668\u5176\u5b9e\u5c31\u662fSerial\u6536\u96c6\u5668\u7684\u591a\u7ebf\u7a0b\u7248\u672c\u3002<strong>\u65b0\u751f\u4ee3\u5e76\u884c\uff0c\u8001\u5e74\u4ee3\u4e32\u884c\uff1b<strong>\u65b0\u751f\u4ee3\u590d\u5236\u7b97\u6cd5\u3001\u8001\u5e74\u4ee3\u6807\u8bb0-\u538b\u7f29\u53c2\u6570\u63a7\u5236\uff1a<\/strong>-XX:+UseParNewGC<\/strong> ParNew\u6536\u96c6\u5668\u3002<\/p>\n<p><strong>-XX:ParallelGCThreads<\/strong> \u9650\u5236\u7ebf\u7a0b\u6570\u91cf<\/p>\n<p><img decoding=\"async\" class=\"lazyload\"data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-33\/20230714145333dddd2dc58.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" alt=\"Image\"><noscript><img decoding=\"async\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-33\/20230714145333dddd2dc58.png\" alt=\"Image\"><\/noscript><\/p>\n<h3><a id=\"3_Parallel_457\"><\/a>3. Parallel\u6536\u96c6\u5668<\/h3>\n<p>Parallel Scavenge\u6536\u96c6\u5668\u7c7b\u4f3cParNew\u6536\u96c6\u5668\uff0cParallel\u6536\u96c6\u5668\u66f4\u5173\u6ce8\u7cfb\u7edf\u7684<strong>\u541e\u5410\u91cf<\/strong>\u3002\u53ef\u4ee5\u901a\u8fc7\u53c2\u6570\u6765\u6253\u5f00\u81ea\u9002\u5e94\u8c03\u8282\u7b56\u7565\uff0c<strong>\u865a\u62df\u673a\u4f1a\u6839\u636e\u5f53\u524d\u7cfb\u7edf\u7684\u8fd0\u884c\u60c5\u51b5\u6536\u96c6\u6027\u80fd\u76d1\u63a7\u4fe1\u606f\uff0c\u52a8\u6001\u8c03\u6574\u8fd9\u4e9b\u53c2\u6570\u4ee5\u63d0\u4f9b\u6700\u5408\u9002\u7684\u505c\u987f\u65f6\u95f4\u6216\u6700\u5927\u7684\u541e\u5410\u91cf\uff1b\u4e5f\u53ef\u4ee5\u901a\u8fc7\u53c2\u6570\u63a7\u5236GC\u7684\u65f6\u95f4\u4e0d\u5927\u4e8e\u591a\u5c11\u6beb\u79d2\u6216\u8005\u6bd4\u4f8b\uff1b\u65b0\u751f\u4ee3\u590d\u5236\u7b97\u6cd5\u3001\u8001\u5e74\u4ee3\u6807\u8bb0-\u538b\u7f29\u3002<\/strong><\/p>\n<p>\u53c2\u6570\u63a7\u5236\uff1a<strong>-XX:+UseParallelGC<\/strong> \u4f7f\u7528Parallel\u6536\u96c6\u5668+ \u8001\u5e74\u4ee3\u4e32\u884c\u3002<\/p>\n<h3><a id=\"4_ParallelOld_463\"><\/a>4. ParallelOld\u6536\u96c6\u5668<\/h3>\n<p><strong>Parallel Old\u662fParallel Scavenge\u6536\u96c6\u5668\u7684\u8001\u5e74\u4ee3\u7248\u672c\uff0c\u4f7f\u7528\u591a\u7ebf\u7a0b\u548c\u201c\u6807\u8bb0\uff0d\u6574\u7406\u201d\u7b97\u6cd5\u3002<\/strong><\/p>\n<p>**\u8fd9\u4e2a\u6536\u96c6\u5668\u662f\u5728JDK 1.6\u4e2d\u624d\u5f00\u59cb\u63d0\u4f9b\u53c2\u6570\u63a7\u5236\uff1a <strong>-XX:+UseParallelOldGC<\/strong> \u4f7f\u7528Parallel\u6536\u96c6\u5668+ \u8001\u5e74\u4ee3\u5e76\u884c<\/p>\n<h3><a id=\"5_CMS_469\"><\/a>5. CMS\u6536\u96c6\u5668<\/h3>\n<p>CMS\uff08Concurrent Mark Sweep\uff09\u6536\u96c6\u5668\u662f\u4e00\u79cd\u4ee5\u83b7\u53d6\u6700\u77ed\u56de\u6536\u505c\u987f\u65f6\u95f4\u4e3a\u76ee\u6807\u7684\u6536\u96c6\u5668\u3002\u76ee\u524d\u5f88\u5927\u4e00\u90e8\u5206\u7684Java\u5e94\u7528\u90fd\u96c6\u4e2d\u5728\u4e92\u8054\u7f51\u7ad9\u6216B\/S\u7cfb\u7edf\u7684\u670d\u52a1\u7aef\u4e0a\uff0c\u8fd9\u7c7b\u5e94\u7528\u5c24\u5176\u91cd\u89c6\u670d\u52a1\u7684\u54cd\u5e94\u901f\u5ea6\uff0c\u5e0c\u671b\u7cfb\u7edf\u505c\u987f\u65f6\u95f4\u6700\u77ed\uff0c\u4ee5\u7ed9\u7528\u6237\u5e26\u6765\u8f83\u597d\u7684\u4f53\u9a8c\u3002<\/p>\n<p>\u4ece\u540d\u5b57\uff08\u5305\u542b\u201cMark Sweep\u201d\uff09\u4e0a\u5c31\u53ef\u4ee5\u770b\u51faCMS\u6536\u96c6\u5668\u662f\u57fa\u4e8e\u201c\u6807\u8bb0-\u6e05\u9664\u201d\u7b97\u6cd5\u5b9e\u73b0\u7684\uff0c\u5b83\u7684\u8fd0\u4f5c\u8fc7\u7a0b\u76f8\u5bf9\u4e8e\u524d\u9762\u51e0\u79cd\u6536\u96c6\u5668\u6765\u8bf4\u8981\u66f4\u590d\u6742\u4e00\u4e9b\uff0c\u6574\u4e2a\u8fc7\u7a0b\u5206\u4e3a4\u4e2a\u6b65\u9aa4\uff0c\u5305\u62ec\uff1a<\/p>\n<p>\u521d\u59cb\u6807\u8bb0\uff08CMS initial mark\uff09<\/p>\n<p>\u5e76\u53d1\u6807\u8bb0\uff08CMS concurrent mark\uff09<\/p>\n<p>\u91cd\u65b0\u6807\u8bb0\uff08CMS remark\uff09<\/p>\n<p>\u5e76\u53d1\u6e05\u9664\uff08CMS concurrent sweep\uff09<\/p>\n<p><img decoding=\"async\" class=\"lazyload\"data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-34\/202307141453345b5bb0114.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" alt=\"Image\"><noscript><img decoding=\"async\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-34\/202307141453345b5bb0114.png\" alt=\"Image\"><\/noscript><\/p>\n<p>\u5176\u4e2d\u521d\u59cb\u6807\u8bb0\u3001\u91cd\u65b0\u6807\u8bb0\u8fd9\u4e24\u4e2a\u6b65\u9aa4\u4ecd\u7136\u9700\u8981\u201cStop The World\u201d\u3002\u521d\u59cb\u6807\u8bb0\u4ec5\u4ec5\u53ea\u662f\u6807\u8bb0\u4e00\u4e0bGC Roots\u80fd\u76f4\u63a5\u5173\u8054\u5230\u7684\u5bf9\u8c61\uff0c\u901f\u5ea6\u5f88\u5feb\uff0c\u5e76\u53d1\u6807\u8bb0\u9636\u6bb5\u5c31\u662f\u8fdb\u884cGC Roots Tracing\u7684\u8fc7\u7a0b\uff0c\u800c\u91cd\u65b0\u6807\u8bb0\u9636\u6bb5\u5219\u662f\u4e3a\u4e86\u4fee\u6b63\u5e76\u53d1\u6807\u8bb0\u671f\u95f4\uff0c\u56e0\u7528\u6237\u7a0b\u5e8f\u7ee7\u7eed\u8fd0\u4f5c\u800c\u5bfc\u81f4\u6807\u8bb0\u4ea7\u751f\u53d8\u52a8\u7684\u90a3\u4e00\u90e8\u5206\u5bf9\u8c61\u7684\u6807\u8bb0\u8bb0\u5f55\uff0c\u8fd9\u4e2a\u9636\u6bb5\u7684\u505c\u987f\u65f6\u95f4\u4e00\u822c\u4f1a\u6bd4\u521d\u59cb\u6807\u8bb0\u9636\u6bb5\u7a0d\u957f\u4e00\u4e9b\uff0c\u4f46\u8fdc\u6bd4\u5e76\u53d1\u6807\u8bb0\u7684\u65f6\u95f4\u77ed\u3002<\/p>\n<p>\u7531\u4e8e\u6574\u4e2a\u8fc7\u7a0b\u4e2d\u8017\u65f6\u6700\u957f\u7684\u5e76\u53d1\u6807\u8bb0\u548c\u5e76\u53d1\u6e05\u9664\u8fc7\u7a0b\u4e2d\uff0c\u6536\u96c6\u5668\u7ebf\u7a0b\u90fd\u53ef\u4ee5\u4e0e\u7528\u6237\u7ebf\u7a0b\u4e00\u8d77\u5de5\u4f5c\uff0c\u6240\u4ee5\u603b\u4f53\u4e0a\u6765\u8bf4\uff0cCMS\u6536\u96c6\u5668\u7684\u5185\u5b58\u56de\u6536\u8fc7\u7a0b\u662f\u4e0e\u7528\u6237\u7ebf\u7a0b\u4e00\u8d77\u5e76\u53d1\u5730\u6267\u884c\u3002<strong>\u8001\u5e74\u4ee3\u6536\u96c6\u5668<\/strong>\uff08\u65b0\u751f\u4ee3\u4f7f\u7528ParNew\uff09<\/p>\n<p>\u4f18\u70b9: <strong>\u5e76\u53d1\u6536\u96c6<\/strong>\u3001<strong>\u4f4e\u505c\u987f<\/strong><\/p>\n<p>\u7f3a\u70b9\uff1a<strong>\u4ea7\u751f\u5927\u91cf\u7a7a\u95f4\u788e\u7247<\/strong>\u3001\u5e76\u53d1\u9636\u6bb5\u4f1a\u964d\u4f4e\u541e\u5410\u91cf<\/p>\n<p>\u53c2\u6570\u63a7\u5236\uff1a<\/p>\n<p><strong>-XX:+UseConcMarkSweepGC<\/strong> \u4f7f\u7528CMS\u6536\u96c6\u5668<\/p>\n<p><strong>-XX:+UseCMSCompactAtFullCollection<\/strong> Full GC\u540e\uff0c\u8fdb\u884c\u4e00\u6b21\u788e\u7247\u6574\u7406\uff1b\u6574\u7406\u8fc7\u7a0b\u662f\u72ec\u5360\u7684\uff0c\u4f1a\u5f15\u8d77\u505c\u987f\u65f6\u95f4\u53d8\u957f<\/p>\n<p><strong>-XX:+CMSFullGCsBeforeCompaction<\/strong> \u8bbe\u7f6e\u8fdb\u884c\u51e0\u6b21Full GC\u540e\uff0c\u8fdb\u884c\u4e00\u6b21\u788e\u7247\u6574\u7406<\/p>\n<p>-<strong>XX:ParallelCMSThreads<\/strong> \u8bbe\u5b9aCMS\u7684\u7ebf\u7a0b\u6570\u91cf\uff08\u4e00\u822c\u60c5\u51b5\u7ea6\u7b49\u4e8e\u53ef\u7528CPU\u6570\u91cf\uff09<\/p>\n<h3><a id=\"6_G1_505\"><\/a>6. G1\u6536\u96c6\u5668<\/h3>\n<p>G1\u662f\u76ee\u524d\u6280\u672f\u53d1\u5c55\u7684\u6700\u524d\u6cbf\u6210\u679c\u4e4b\u4e00\uff0cHotSpot\u5f00\u53d1\u56e2\u961f\u8d4b\u4e88\u5b83\u7684\u4f7f\u547d\u662f\u672a\u6765\u53ef\u4ee5\u66ff\u6362\u6389JDK1.5\u4e2d\u53d1\u5e03\u7684CMS\u6536\u96c6\u5668\u3002\u4e0eCMS\u6536\u96c6\u5668\u76f8\u6bd4G1\u6536\u96c6\u5668\u6709\u4ee5\u4e0b\u7279\u70b9\uff1a<\/p>\n<ol>\n<li><strong>\u7a7a\u95f4\u6574\u5408<\/strong>\uff0cG1\u6536\u96c6\u5668\u91c7\u7528\u6807\u8bb0\u6574\u7406\u7b97\u6cd5\uff0c\u4e0d\u4f1a\u4ea7\u751f\u5185\u5b58\u7a7a\u95f4\u788e\u7247\u3002\u5206\u914d\u5927\u5bf9\u8c61\u65f6\u4e0d\u4f1a\u56e0\u4e3a\u65e0\u6cd5\u627e\u5230\u8fde\u7eed\u7a7a\u95f4\u800c\u63d0\u524d\u89e6\u53d1\u4e0b\u4e00\u6b21GC\u3002<\/li>\n<li><strong>\u53ef\u9884\u6d4b\u505c\u987f<\/strong>\uff0c\u8fd9\u662fG1\u7684\u53e6\u4e00\u5927\u4f18\u52bf\uff0c\u964d\u4f4e\u505c\u987f\u65f6\u95f4\u662fG1\u548cCMS\u7684\u5171\u540c\u5173\u6ce8\u70b9\uff0c\u4f46G1\u9664\u4e86\u8ffd\u6c42\u4f4e\u505c\u987f\u5916\uff0c\u8fd8\u80fd\u5efa\u7acb\u53ef\u9884\u6d4b\u7684\u505c\u987f\u65f6\u95f4\u6a21\u578b\uff0c\u80fd\u8ba9\u4f7f\u7528\u8005\u660e\u786e\u6307\u5b9a\u5728\u4e00\u4e2a\u957f\u5ea6\u4e3aN\u6beb\u79d2\u7684\u65f6\u95f4\u7247\u6bb5\u5185\uff0c\u6d88\u8017\u5728\u5783\u573e\u6536\u96c6\u4e0a\u7684\u65f6\u95f4\u4e0d\u5f97\u8d85\u8fc7N\u6beb\u79d2\uff0c\u8fd9\u51e0\u4e4e\u5df2\u7ecf\u662f\u5b9e\u65f6Java\uff08RTSJ\uff09\u7684\u5783\u573e\u6536\u96c6\u5668\u7684\u7279\u5f81\u4e86\u3002\u4e0a\u9762\u63d0\u5230\u7684\u5783\u573e\u6536\u96c6\u5668\uff0c\u6536\u96c6\u7684\u8303\u56f4\u90fd\u662f\u6574\u4e2a\u65b0\u751f\u4ee3\u6216\u8005\u8001\u5e74\u4ee3\uff0c\u800cG1\u4e0d\u518d\u662f\u8fd9\u6837\u3002\u4f7f\u7528G1\u6536\u96c6\u5668\u65f6\uff0cJava\u5806\u7684\u5185\u5b58\u5e03\u5c40\u4e0e\u5176\u4ed6\u6536\u96c6\u5668\u6709\u5f88\u5927\u5dee\u522b\uff0c\u5b83\u5c06\u6574\u4e2aJava\u5806\u5212\u5206\u4e3a\u591a\u4e2a\u5927\u5c0f\u76f8\u7b49\u7684\u72ec\u7acb\u533a\u57df\uff08Region\uff09\uff0c\u867d\u7136\u8fd8\u4fdd\u7559\u6709\u65b0\u751f\u4ee3\u548c\u8001\u5e74\u4ee3\u7684\u6982\u5ff5\uff0c\u4f46\u65b0\u751f\u4ee3\u548c\u8001\u5e74\u4ee3\u4e0d\u518d\u662f\u7269\u7406\u9694\u9602\u4e86\uff0c\u5b83\u4eec\u90fd\u662f\u4e00\u90e8\u5206\uff08\u53ef\u4ee5\u4e0d\u8fde\u7eed\uff09Region\u7684\u96c6\u5408\u3002<\/li>\n<\/ol>\n<p><img decoding=\"async\" class=\"lazyload\"data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-34\/202307141453346868ee747.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" alt=\"Image\"><noscript><img decoding=\"async\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-34\/202307141453346868ee747.png\" alt=\"Image\"><\/noscript><\/p>\n<p>G1\u7684\u65b0\u751f\u4ee3\u6536\u96c6\u8ddfParNew\u7c7b\u4f3c\uff0c\u5f53\u65b0\u751f\u4ee3\u5360\u7528\u8fbe\u5230\u4e00\u5b9a\u6bd4\u4f8b\u7684\u65f6\u5019\uff0c\u5f00\u59cb\u51fa\u53d1\u6536\u96c6\u3002\u548cCMS\u7c7b\u4f3c\uff0cG1\u6536\u96c6\u5668\u6536\u96c6\u8001\u5e74\u4ee3\u5bf9\u8c61\u4f1a\u6709\u77ed\u6682\u505c\u987f\u3002<\/p>\n<h3><a id=\"7__517\"><\/a>7. \u5e38\u7528\u7684\u6536\u96c6\u5668\u7ec4\u5408<\/h3>\n<p><img decoding=\"async\" class=\"lazyload\"data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-34\/20230714145334181886874.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" alt=\"image-20210714175707934\"><noscript><img decoding=\"async\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-34\/20230714145334181886874.png\" alt=\"image-20210714175707934\"><\/noscript><\/p>\n<p><img decoding=\"async\" class=\"lazyload\"data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-35\/20230714145335c5c5814f1.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" alt=\"image-20210714175852104\"><noscript><img decoding=\"async\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-35\/20230714145335c5c5814f1.png\" alt=\"image-20210714175852104\"><\/noscript><\/p>\n<\/div>\n<link href=\"https:\/\/csdnimg.cn\/release\/blogv2\/dist\/mdeditor\/css\/editerView\/markdown_views-98b95bb57c.css\" rel=\"stylesheet\">\n \t<link href=\"https:\/\/csdnimg.cn\/release\/blogv2\/dist\/mdeditor\/css\/style-c216769e99.css\" rel=\"stylesheet\">\u672c\u7bc7\u6587\u7ae0\u6765\u6e90\u4e8eCSDN\uff1ahttps:\/\/blog.csdn.net\/weixin_44203782\/article\/details\/131312116<\/p>\n","raw":"","protected":false},"excerpt":{"rendered":"<p>JVM\u56fe\u89e3 \u4e00\u3001JVM\u7684\u8fd0\u884c\u65f6\u6570\u636e\u533a \u6982\u89c8JVM\u8fd0\u884c\u65f6\u6570\u636e\u533a\u4e3b\u8981\u5305\u62ec\u4ee5\u4e0b\u51e0\u4e2a\u90e8\u5206\uff1a\u7a0b\u5e8f\u8ba1\u6570\u5668\u3001\u865a\u62df\u673a\u6808\u3001\u672c\u5730\u65b9\u6cd5\u6808\u3001\u65b9\u6cd5\u533a\u3001\u5806\uff1b\u5176 &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"emotion":"","emotion_color":"","title_style":"","license":"","footnotes":""},"categories":[27],"tags":[],"class_list":["post-2930","post","type-post","status-publish","format-standard","hentry","category-jvm"],"post_thumbnail_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-26\/2023071414532619195e43b.png","content_first_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-26\/2023071414532619195e43b.png","post_medium_image_300":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-26\/2023071414532619195e43b.png","post_thumbnail_image_624":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-26\/2023071414532619195e43b.png","post_frist_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-26\/2023071414532619195e43b.png","post_medium_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-26\/2023071414532619195e43b.png","post_large_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-26\/2023071414532619195e43b.png","post_full_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-26\/2023071414532619195e43b.png","post_all_images":[{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-26\/2023071414532619195e43b.png","id":"image0"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-26\/2023071414532619195e43b.png","id":"image1"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-27\/20230714145327b2b27b928.png","id":"image2"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-27\/20230714145327b2b27b928.png","id":"image3"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-28\/202307141453283d3d53eb4.png","id":"image4"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-28\/202307141453283d3d53eb4.png","id":"image5"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-28\/202307141453289d9d05411.png","id":"image6"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-28\/202307141453289d9d05411.png","id":"image7"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-28\/2023071414532849499481f.png","id":"image8"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-28\/2023071414532849499481f.png","id":"image9"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-28\/20230714145328f4f4129c7.png","id":"image10"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-28\/20230714145328f4f4129c7.png","id":"image11"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-29\/202307141453295a5a95ccd.png","id":"image12"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-29\/202307141453295a5a95ccd.png","id":"image13"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-29\/20230714145329fbfbe0e9a.png","id":"image14"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-29\/20230714145329fbfbe0e9a.png","id":"image15"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-29\/2023071414532976769ae44.png","id":"image16"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-29\/2023071414532976769ae44.png","id":"image17"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-30\/20230714145330f3f3851c3.png","id":"image18"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-30\/20230714145330f3f3851c3.png","id":"image19"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-30\/20230714145330070793a5c.png","id":"image20"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-30\/20230714145330070793a5c.png","id":"image21"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-30\/202307141453300707fae57.png","id":"image22"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-30\/202307141453300707fae57.png","id":"image23"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-30\/20230714145330f6f6481c8.png","id":"image24"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-30\/20230714145330f6f6481c8.png","id":"image25"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-31\/20230714145331555514c31.png","id":"image26"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-31\/20230714145331555514c31.png","id":"image27"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-31\/20230714145331fbfb6ada8.png","id":"image28"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-31\/20230714145331fbfb6ada8.png","id":"image29"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-31\/202307141453315858cf2ff.png","id":"image30"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-31\/202307141453315858cf2ff.png","id":"image31"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-31\/202307141453316a6aa4f45.png","id":"image32"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-31\/202307141453316a6aa4f45.png","id":"image33"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-32\/202307141453324545d5b1d.png","id":"image34"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-32\/202307141453324545d5b1d.png","id":"image35"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-32\/20230714145332cbcb5b68d.png","id":"image36"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-32\/20230714145332cbcb5b68d.png","id":"image37"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-32\/202307141453327e7e55f13.png","id":"image38"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-32\/202307141453327e7e55f13.png","id":"image39"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-33\/202307141453338585dc4b0.png","id":"image40"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-33\/202307141453338585dc4b0.png","id":"image41"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-33\/202307141453330d0d681c3.png","id":"image42"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-33\/202307141453330d0d681c3.png","id":"image43"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-33\/20230714145333dddd2dc58.png","id":"image44"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-33\/20230714145333dddd2dc58.png","id":"image45"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-34\/202307141453345b5bb0114.png","id":"image46"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-34\/202307141453345b5bb0114.png","id":"image47"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-34\/202307141453346868ee747.png","id":"image48"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-34\/202307141453346868ee747.png","id":"image49"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-34\/20230714145334181886874.png","id":"image50"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-34\/20230714145334181886874.png","id":"image51"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-35\/20230714145335c5c5814f1.png","id":"image52"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/default\/nine\/2023-07-14\/14-53-35\/20230714145335c5c5814f1.png","id":"image53"}],"videoAdId":"","listAd":"0","listAdId":"","listAdEvery":6,"total_comments":0,"category_name":"JVM","post_date":"2023-07-14","like_count":"0","praiseWord":"\u9f13\u52b1","copyright_state":"","excitationAd":"0","rewardedVideoAdId":"","detailAdId":"","detailAd":"0","enterpriseMinapp":"0","audios":[],"postImageUrl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230519082947553.jpg","avatarurls":[],"related_posts":null,"pageviews":399,"next_post_id":3099,"next_post_title":"\u8bb0\u4e00\u6b21 JVM CPU \u4f7f\u7528\u7387\u98d9\u9ad8\u95ee\u9898\u7684\u6392\u67e5\u8fc7\u7a0b","previous_post_id":2922,"previous_post_title":"2023\u5e74\u6700\u65b0kafka\u5e38\u89c1\u9762\u8bd5\u9898","_links":{"self":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/2930","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/comments?post=2930"}],"version-history":[{"count":0,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/2930\/revisions"}],"wp:attachment":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/media?parent=2930"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/categories?post=2930"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/tags?post=2930"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}