{"id":87859,"date":"2026-07-31T01:00:30","date_gmt":"2026-07-30T17:00:30","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/87859.html"},"modified":"2026-07-31T01:00:30","modified_gmt":"2026-07-30T17:00:30","slug":"%e3%80%90jvm%e5%8e%9f%e7%90%86%e8%af%a6%e8%a7%a3%e3%80%9124-%e5%9e%83%e5%9c%be%e5%9b%9e%e6%94%b6%e7%ae%97%e6%b3%95-%e6%a0%87%e8%ae%b0%e6%b8%85%e9%99%a4%e5%a4%8d%e5%88%b6%e6%95%b4%e7%90%86%e5%88%86","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/87859.html","title":{"rendered":"\u3010JVM\u539f\u7406\u8be6\u89e3\u301124-\u5783\u573e\u56de\u6536\u7b97\u6cd5-\u6807\u8bb0\u6e05\u9664\u590d\u5236\u6574\u7406\u5206\u4ee3"},"content":{"rendered":"<h2>24-\u5783\u573e\u56de\u6536\u7b97\u6cd5&#xff1a;\u6807\u8bb0-\u6e05\u9664\u3001\u590d\u5236\u3001\u6574\u7406\u4e0e\u5206\u4ee3<\/h2>\n<p>\u77e5\u9053\u4e86&#034;\u54ea\u4e9b\u5bf9\u8c61\u6d3b\u7740\u3001\u54ea\u4e9b\u8be5\u6b7b&#034;&#xff0c;\u4e0b\u4e00\u6b65\u5c31\u662f&#034;\u5982\u4f55\u9ad8\u6548\u56de\u6536\u6b7b\u5bf9\u8c61&#034;\u3002GC \u7b97\u6cd5\u7ecf\u8fc7\u51e0\u5341\u5e74\u7684\u6f14\u5316&#xff0c;\u6c89\u6dc0\u51fa\u56db\u79cd\u57fa\u7840\u8303\u5f0f&#xff1a;Mark-Sweep&#xff08;\u6807\u8bb0-\u6e05\u9664&#xff09;\u3001Copying&#xff08;\u590d\u5236&#xff09;\u3001Mark-Compact&#xff08;\u6807\u8bb0-\u6574\u7406&#xff09; \u548c Generational&#xff08;\u5206\u4ee3\u6536\u96c6&#xff09;\u3002\u672c\u7bc7\u5c06\u9010\u4e00\u62c6\u89e3\u5b83\u4eec\u7684\u539f\u7406\u3001\u4f18\u52a3\u4e0e\u9002\u7528\u573a\u666f&#xff0c;\u5e76\u8ba8\u8bba HotSpot \u4e2d\u7684\u5361\u8868\u673a\u5236\u5982\u4f55\u89e3\u51b3\u8de8\u4ee3\u5f15\u7528\u95ee\u9898\u3002<\/p>\n<h3>Mark-Sweep&#xff1a;\u6807\u8bb0-\u6e05\u9664<\/h3>\n<p>\u8fd9\u662f\u6700\u57fa\u7840\u3001\u4e5f\u6700\u76f4\u89c2\u7684 GC \u7b97\u6cd5\u3002\u8fc7\u7a0b\u5206\u4e24\u6b65&#xff1a;<\/p>\n<li>\u6807\u8bb0\u9636\u6bb5&#xff1a;\u4ece GC Roots \u51fa\u53d1&#xff0c;\u904d\u5386\u5bf9\u8c61\u56fe&#xff0c;\u6807\u8bb0\u6240\u6709\u5b58\u6d3b\u5bf9\u8c61\u3002<\/li>\n<li>\u6e05\u9664\u9636\u6bb5&#xff1a;\u7ebf\u6027\u626b\u63cf\u5806&#xff0c;\u56de\u6536\u672a\u6807\u8bb0\u7684\u5bf9\u8c61\u3002<\/li>\n<p>\u6807\u8bb0\u524d:  [A*] [B] [C*] [D] [E*]      (* \u4e3a\u5b58\u6d3b)<br \/>\n\u6807\u8bb0\u540e:  [A*] [ ] [C*] [ ] [E*]<br \/>\n              \u788e\u7247     \u788e\u7247<\/p>\n<h4>\u4f18\u70b9<\/h4>\n<ul>\n<li>\u5b9e\u73b0\u7b80\u5355&#xff0c;\u4e0d\u9700\u8981\u79fb\u52a8\u5bf9\u8c61\u3002<\/li>\n<li>\u5728\u5b58\u6d3b\u5bf9\u8c61\u6bd4\u4f8b\u8f83\u4f4e\u65f6\u6548\u7387\u8f83\u9ad8&#xff08;\u5c11\u6807\u8bb0\u3001\u591a\u56de\u6536&#xff09;\u3002<\/li>\n<\/ul>\n<h4>\u7f3a\u70b9<\/h4>\n<ul>\n<li>\u6548\u7387\u4e0d\u7a33\u5b9a&#xff1a;\u6807\u8bb0\u548c\u6e05\u9664\u90fd\u968f\u5806\u589e\u5927\u800c\u7ebf\u6027\u589e\u957f\u3002<\/li>\n<li>\u5185\u5b58\u788e\u7247&#xff1a;\u56de\u6536\u540e\u4ea7\u751f\u5927\u91cf\u4e0d\u8fde\u7eed\u7a7a\u95f4\u3002\u540e\u7eed\u5206\u914d\u5927\u5bf9\u8c61\u65f6\u53ef\u80fd\u627e\u4e0d\u5230\u8db3\u591f\u8fde\u7eed\u7a7a\u95f4&#xff0c;\u89e6\u53d1\u63d0\u524d GC\u3002<\/li>\n<\/ul>\n<p>Mark-Sweep \u662f\u65e9\u671f JVM \u7684\u4e3b\u6d41\u7b97\u6cd5&#xff0c;\u4e5f\u662f CMS&#xff08;Concurrent Mark Sweep&#xff09;\u6536\u96c6\u5668\u7684\u6838\u5fc3\u3002CMS \u4e4b\u6240\u4ee5\u88ab\u6dd8\u6c70&#xff0c;\u788e\u7247\u95ee\u9898\u662f\u91cd\u8981\u539f\u56e0\u4e4b\u4e00\u2014\u2014\u957f\u671f\u8fd0\u884c\u540e\u9700\u8981 Full GC \u6765\u6574\u7406\u7a7a\u95f4\u3002<\/p>\n<h4>\u6f14\u8fdb&#xff1a;\u6807\u8bb0-\u6e05\u9664\u7684\u5bf9\u8c61\u5934\u5f00\u9500<\/h4>\n<p>HotSpot \u5728\u5bf9\u8c61\u5934&#xff08;Mark Word&#xff09;\u4e2d\u7528\u4e00\u4e2a bit \u6807\u8bb0\u5bf9\u8c61\u7684\u5b58\u6d3b\u72b6\u6001\u3002\u6807\u8bb0\u9636\u6bb5\u4f1a\u4fee\u6539\u5bf9\u8c61\u5934&#xff0c;\u8fd9\u4e2a\u5199\u5165\u64cd\u4f5c\u5728\u5e76\u53d1\u6536\u96c6\u5668\u4e2d\u9700\u8981\u5199\u5c4f\u969c\u652f\u6301&#xff0c;\u662f CMS\/G1 \u6027\u80fd\u5f00\u9500\u7684\u6765\u6e90\u4e4b\u4e00\u3002<\/p>\n<h3>Copying&#xff1a;\u590d\u5236\u7b97\u6cd5<\/h3>\n<p>\u590d\u5236\u7b97\u6cd5\u7684\u601d\u8def\u662f&#034;\u7528\u7a7a\u95f4\u6362\u65f6\u95f4&#034;&#xff1a;\u5c06\u5185\u5b58\u5e73\u5206\u4e3a\u4e24\u5757&#xff0c;\u6bcf\u6b21\u53ea\u7528\u5176\u4e2d\u4e00\u5757&#xff1b;GC \u65f6\u628a\u5b58\u6d3b\u5bf9\u8c61\u5168\u90e8\u590d\u5236\u5230\u53e6\u4e00\u5757&#xff0c;\u7136\u540e\u6e05\u7a7a\u5f53\u524d\u5757\u3002<\/p>\n<p>From \u533a: [A*] [B] [C*] [D] [E*]<br \/>\n              \u2193 \u590d\u5236<br \/>\nTo   \u533a: [A*] [C*] [E*] [   &#8230;   ]<br \/>\nFrom \u533a\u6e05\u7a7a&#xff0c;\u89d2\u8272\u4e92\u6362<\/p>\n<h4>\u4f18\u70b9<\/h4>\n<ul>\n<li>\u65e0\u788e\u7247&#xff1a;\u590d\u5236\u540e\u7684\u5bf9\u8c61\u7d27\u5bc6\u6392\u5217\u3002<\/li>\n<li>\u5206\u914d\u5feb&#xff1a;\u5206\u914d\u65f6\u53ea\u9700\u79fb\u52a8\u6307\u9488&#xff08;bump pointer&#xff09;\u3002<\/li>\n<li>\u5f53\u5b58\u6d3b\u5bf9\u8c61\u5f88\u5c11\u65f6&#xff0c;\u590d\u5236\u6548\u7387\u975e\u5e38\u9ad8\u2014\u2014\u53ea\u642c\u8fd0\u5c11\u91cf\u5b58\u6d3b\u5bf9\u8c61\u5373\u53ef\u5b8c\u6210\u56de\u6536\u3002<\/li>\n<\/ul>\n<h4>\u7f3a\u70b9<\/h4>\n<ul>\n<li>\u7a7a\u95f4\u5229\u7528\u7387\u4f4e&#xff1a;\u53ef\u7528\u5185\u5b58\u76f4\u63a5\u51cf\u534a&#xff0c;\u8fd9\u662f\u65e0\u6cd5\u63a5\u53d7\u7684\u4ee3\u4ef7\u3002<\/li>\n<li>\u5b58\u6d3b\u5bf9\u8c61\u591a\u65f6\u590d\u5236\u5f00\u9500\u5927&#xff1a;\u6781\u7aef\u60c5\u51b5\u4e0b\u6240\u6709\u5bf9\u8c61\u90fd\u5b58\u6d3b&#xff0c;\u590d\u5236\u6210\u672c\u63a5\u8fd1\u5168\u5806\u626b\u63cf\u3002<\/li>\n<\/ul>\n<p>HotSpot \u7684\u89e3\u51b3\u65b9\u6848\u662fAppel \u5f0f\u56de\u6536&#xff1a;\u65b0\u751f\u4ee3\u5e76\u4e0d\u6309 1:1 \u5212\u5206&#xff0c;\u800c\u662f Eden : Survivor0 : Survivor1 &#061; 8 : 1 : 1&#xff0c;\u6bcf\u6b21\u53ea\u7528 Eden &#043; \u4e00\u4e2a Survivor&#xff0c;\u56de\u6536\u65f6\u628a\u5b58\u6d3b\u5bf9\u8c61\u590d\u5236\u5230\u53e6\u4e00\u4e2a Survivor\u3002\u8fd9\u6837\u6d6a\u8d39\u7684\u7a7a\u95f4\u53ea\u6709 10%\u3002<\/p>\n<p>|&#8212;&#8211; Eden (80%) &#8212;&#8211;|&#8211; S0 (10%) &#8211;|&#8211; S1 (10%) &#8211;|<br \/>\n                          \u2191             \u2191<br \/>\n                        \u4f7f\u7528\u4e2d          \u7a7a&#xff08;\u5907\u4efd\u533a&#xff09;<\/p>\n<p>\u8fd9\u5c31\u662f\u65b0\u751f\u4ee3\u91c7\u7528\u590d\u5236\u7b97\u6cd5\u7684\u6839\u672c\u539f\u56e0\u2014\u2014\u65b0\u751f\u4ee3&#034;\u671d\u751f\u5915\u706d&#034;\u7684\u7279\u6027\u8ba9\u590d\u5236\u6210\u672c\u6781\u4f4e\u3002<\/p>\n<h4>Survivor \u533a\u7684\u4f5c\u7528<\/h4>\n<p>Survivor \u4e0d\u662f&#034;\u4e3a\u4e86\u5907\u4efd&#034;\u800c\u5b58\u5728&#xff0c;\u5b83\u7684\u672c\u8d28\u662f**\u201c\u664b\u5347\u7f13\u51b2\u533a\u201d**&#xff1a;\u7ecf\u5386\u591a\u6b21 Minor GC \u4ecd\u5b58\u6d3b\u7684\u5bf9\u8c61\u4f1a\u88ab\u664b\u5347\u5230\u8001\u5e74\u4ee3\u3002-XX:MaxTenuringThreshold&#xff08;\u9ed8\u8ba4 15&#xff09;\u63a7\u5236\u664b\u5347\u5e74\u9f84\u9608\u503c\u3002<\/p>\n<p><span class=\"token comment\"># \u8c03\u6574\u664b\u5347\u9608\u503c<\/span><br \/>\n<span class=\"token function\">java<\/span> <span class=\"token parameter variable\">-XX:MaxTenuringThreshold<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token number\">10<\/span> <span class=\"token parameter variable\">-cp<\/span> MyApp com.example.Main<\/p>\n<h3>Mark-Compact&#xff1a;\u6807\u8bb0-\u6574\u7406<\/h3>\n<p>\u6807\u8bb0-\u6574\u7406\u7b97\u6cd5\u7ed3\u5408\u4e86\u524d\u4e24\u8005\u7684\u601d\u8def&#xff1a;\u5148\u6807\u8bb0\u5b58\u6d3b\u5bf9\u8c61&#xff08;\u540c Mark-Sweep&#xff09;&#xff0c;\u7136\u540e\u5c06\u5b58\u6d3b\u5bf9\u8c61\u5411\u4e00\u7aef\u79fb\u52a8&#xff0c;\u6e05\u7406\u8fb9\u754c\u4ee5\u5916\u7684\u7a7a\u95f4\u3002<\/p>\n<p>\u6807\u8bb0\u524d:  [A*] [B] [C*] [D] [E*]<br \/>\n\u6574\u7406\u540e:  [A*] [C*] [E*] [&#8212;&#8212;- \u7a7a &#8212;&#8212;-]<\/p>\n<h4>\u4f18\u70b9<\/h4>\n<ul>\n<li>\u65e0\u788e\u7247&#xff1a;\u79fb\u52a8\u540e\u7a7a\u95f4\u8fde\u7eed\u3002<\/li>\n<li>\u7a7a\u95f4\u5229\u7528\u7387\u9ad8&#xff1a;\u4e0d\u50cf\u590d\u5236\u7b97\u6cd5\u90a3\u6837\u6d6a\u8d39\u4e00\u534a\u7a7a\u95f4\u3002<\/li>\n<\/ul>\n<h4>\u7f3a\u70b9<\/h4>\n<ul>\n<li>\u79fb\u52a8\u5bf9\u8c61\u5f00\u9500\u5927&#xff1a;\u79fb\u52a8\u540e\u9700\u8981\u66f4\u65b0\u6240\u6709\u6307\u5411\u8fd9\u4e9b\u5bf9\u8c61\u7684\u5f15\u7528&#xff0c;\u5199\u5c4f\u969c\u6216 STW \u4e0d\u53ef\u5c11\u3002<\/li>\n<li>\u6682\u505c\u65f6\u95f4\u66f4\u957f&#xff1a;\u76f8\u6bd4 Mark-Sweep&#xff0c;\u6574\u7406\u9636\u6bb5\u66f4\u8017\u65f6\u3002<\/li>\n<\/ul>\n<p>\u8001\u5e74\u4ee3\u901a\u5e38\u91c7\u7528 Mark-Compact&#xff0c;\u56e0\u4e3a\u8001\u5e74\u4ee3\u5b58\u6d3b\u7387\u9ad8&#xff0c;\u590d\u5236\u7b97\u6cd5\u6210\u672c\u4e0d\u53ef\u63a5\u53d7\u3002\u4f46\u4e5f\u8981\u6ce8\u610f&#xff1a;\u79fb\u52a8\u5bf9\u8c61\u4f1a\u5bfc\u81f4\u66f4\u957f\u7684 STW&#xff0c;\u6240\u4ee5\u6709\u4e9b\u6536\u96c6\u5668&#xff08;\u5982 CMS&#xff09;\u9009\u62e9\u4e0d\u6574\u7406&#xff0c;\u7528 Mark-Sweep \u6362\u53d6\u66f4\u4f4e\u7684\u505c\u987f\u3002<\/p>\n<h3>Generational&#xff1a;\u5206\u4ee3\u6536\u96c6<\/h3>\n<p>\u5206\u4ee3\u6536\u96c6\u4e0d\u662f\u4e00\u79cd\u72ec\u7acb\u7684\u7b97\u6cd5&#xff0c;\u800c\u662f\u4e00\u79cd\u7406\u8bba\u6846\u67b6\u2014\u2014\u5b83\u57fa\u4e8e\u5f31\u4ee3\u5047\u8bf4&#xff08;Weak Generational Hypothesis&#xff09;&#xff1a;<\/p>\n<li>\u7edd\u5927\u591a\u6570\u5bf9\u8c61\u671d\u751f\u5915\u706d\u3002<\/li>\n<li>\u71ac\u8fc7\u8d8a\u591a\u6b21 GC \u7684\u5bf9\u8c61\u8d8a\u96be\u4ee5\u6d88\u4ea1\u3002<\/li>\n<p>\u57fa\u4e8e\u8fd9\u4e24\u70b9\u89c2\u5bdf&#xff0c;HotSpot \u628a\u5806\u5206\u4e3a\u65b0\u751f\u4ee3&#xff08;Young Generation&#xff09;\u548c\u8001\u5e74\u4ee3&#xff08;Old Generation&#xff09;&#xff0c;\u9488\u5bf9\u4e0d\u540c\u4ee3\u91c7\u7528\u4e0d\u540c\u7b97\u6cd5&#xff1a;<\/p>\n<ul>\n<li>\u65b0\u751f\u4ee3&#xff1a;\u5b58\u6d3b\u7387\u4f4e&#xff0c;\u7528 Copying&#xff08;Minor GC&#xff09;\u3002<\/li>\n<li>\u8001\u5e74\u4ee3&#xff1a;\u5b58\u6d3b\u7387\u9ad8&#xff0c;\u7528 Mark-Sweep \u6216 Mark-Compact&#xff08;Major GC \/ Full GC&#xff09;\u3002<\/li>\n<\/ul>\n<p>|&#8212;&#8212;&#8212;&#8212; \u65b0\u751f\u4ee3 (1\/3) &#8212;&#8212;&#8212;&#8212;|&#8212;&#8212;&#8211; \u8001\u5e74\u4ee3 (2\/3) &#8212;&#8212;&#8211;|<br \/>\n|  Eden  |  S0  |  S1  |              |                              |<br \/>\n| \u590d\u5236\u7b97\u6cd5                       Mark-Compact \/ Mark-Sweep<\/p>\n<h4>Minor GC \u4e0e Full GC<\/h4>\n<ul>\n<li>Minor GC \/ Young GC&#xff1a;\u53ea\u56de\u6536\u65b0\u751f\u4ee3&#xff0c;\u9891\u7387\u9ad8\u3001\u505c\u987f\u77ed\u3002<\/li>\n<li>Major GC&#xff1a;\u56de\u6536\u8001\u5e74\u4ee3&#xff0c;\u5e38\u4e0e Minor GC \u8054\u52a8\u3002<\/li>\n<li>Full GC&#xff1a;\u56de\u6536\u6574\u4e2a\u5806\u53ca\u5143\u7a7a\u95f4&#xff0c;\u505c\u987f\u6700\u957f&#xff0c;\u5e94\u5c3d\u91cf\u907f\u514d\u3002<\/li>\n<\/ul>\n<p>\u5de5\u7a0b\u4e0a GC \u8c03\u4f18\u7684\u6838\u5fc3\u76ee\u6807\u5f80\u5f80\u662f\u51cf\u5c11 Full GC \u9891\u7387\u2014\u2014\u901a\u8fc7\u5408\u7406\u8bbe\u7f6e\u65b0\u751f\u4ee3\/\u8001\u5e74\u4ee3\u6bd4\u4f8b\u3001\u664b\u5347\u9608\u503c\u3001 Survivor \u5927\u5c0f&#xff0c;\u8ba9\u77ed\u547d\u5bf9\u8c61\u5728\u65b0\u751f\u4ee3\u5c31\u88ab\u6d88\u5316\u6389&#xff0c;\u4e0d\u8fdb\u5165\u8001\u5e74\u4ee3\u6c61\u67d3\u8001\u5e74\u4ee3\u3002<\/p>\n<h3>\u8de8\u4ee3\u5f15\u7528\u4e0e\u5361\u8868<\/h3>\n<p>\u5206\u4ee3\u6536\u96c6\u6709\u4e00\u4e2a\u7ed5\u4e0d\u5f00\u7684\u95ee\u9898&#xff1a;\u8de8\u4ee3\u5f15\u7528\u3002\u65b0\u751f\u4ee3\u5bf9\u8c61\u53ef\u80fd\u88ab\u8001\u5e74\u4ee3\u5bf9\u8c61\u5f15\u7528&#xff0c;\u53cd\u4e4b\u4ea6\u7136\u3002Minor GC \u65f6\u5982\u679c\u53ea\u626b\u65b0\u751f\u4ee3\u6839&#xff0c;\u5c31\u4f1a\u6f0f\u6389\u8001\u5e74\u4ee3\u6307\u5411\u65b0\u751f\u4ee3\u7684\u5f15\u7528&#xff0c;\u5bfc\u81f4\u8bef\u56de\u6536\u3002<\/p>\n<h4>\u7b80\u5355\u65b9\u6848\u7684\u4ee3\u4ef7<\/h4>\n<p>\u4e00\u79cd\u6734\u7d20\u505a\u6cd5\u662f&#xff1a;Minor GC \u65f6\u628a\u6574\u4e2a\u8001\u5e74\u4ee3\u5f53\u4f5c\u989d\u5916 GC Roots \u6765\u626b\u63cf\u3002\u4f46\u8001\u5e74\u4ee3\u901a\u5e38\u5f88\u5927&#xff0c;\u5168\u626b\u4e00\u904d\u6210\u672c\u4e0d\u53ef\u63a5\u53d7\u3002<\/p>\n<h4>\u5361\u8868&#xff08;Card Table&#xff09;<\/h4>\n<p>HotSpot \u91c7\u7528\u5361\u8868\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898&#xff1a;\u628a\u8001\u5e74\u4ee3\u5212\u5206\u4e3a\u56fa\u5b9a\u5927\u5c0f\u7684&#034;\u5361\u7247&#034;&#xff08;Card&#xff0c;\u901a\u5e38\u662f 512 \u5b57\u8282&#xff09;&#xff0c;\u6bcf\u5f20\u5361\u5bf9\u5e94\u5361\u8868\u4e2d\u7684\u4e00\u4e2a\u5b57\u8282\u3002\u5f53\u8001\u5e74\u4ee3\u5bf9\u8c61\u5199\u5165\u4e00\u4e2a\u6307\u5411\u65b0\u751f\u4ee3\u7684\u5f15\u7528\u65f6&#xff0c;\u901a\u8fc7\u5199\u5c4f\u969c\u628a\u5bf9\u5e94\u5361\u6807\u8bb0\u4e3a&#034;\u810f&#034;&#xff08;dirty&#xff09;\u3002<\/p>\n<p>\u8001\u5e74\u4ee3:  |&#8212;\u53610&#8212;|&#8212;\u53611&#8212;|&#8212;\u53612&#8212;|&#8212;\u53613&#8212;|<br \/>\n\u5361\u8868:      0         1         0         0<br \/>\n                    dirty<\/p>\n<p>Minor GC \u65f6\u53ea\u626b\u63cf&#034;\u810f\u5361&#034;\u5bf9\u5e94\u7684\u8001\u5e74\u4ee3\u533a\u57df&#xff0c;\u628a\u8fd9\u4e9b\u5bf9\u8c61\u4f5c\u4e3a\u9644\u52a0 GC Roots\u3002\u8fd9\u6837\u628a&#034;\u5168\u626b\u8001\u5e74\u4ee3&#034;\u964d\u4e3a&#034;\u53ea\u626b\u810f\u5361&#034;&#xff0c;\u6781\u5927\u964d\u4f4e\u4e86\u8de8\u4ee3\u5f15\u7528\u7684\u626b\u63cf\u6210\u672c\u3002<\/p>\n<h4>\u5199\u5c4f\u969c\u7684\u5f00\u9500<\/h4>\n<p>\u5199\u5c4f\u969c&#xff08;write barrier&#xff09;\u662f JVM \u5728\u6bcf\u6b21\u5f15\u7528\u5199\u5165\u65f6\u63d2\u5165\u7684\u989d\u5916\u903b\u8f91\u3002HotSpot \u4f7f\u7528\u7cbe\u5316\u5361\u8868&#xff08;Card Table Refinement&#xff09;&#xff1a;\u5199\u5c4f\u969c\u53ea\u505a&#034;\u7f6e\u810f&#034;\u8fd9\u4e00\u6700\u4fbf\u5b9c\u7684\u64cd\u4f5c&#xff0c;\u626b\u63cf\u4ea4\u7ed9 GC \u7ebf\u7a0b\u5f02\u6b65&#034;\u7cbe\u5316&#034;\u3002\u8fd9\u79cd\u8bbe\u8ba1\u5728\u541e\u5410\u91cf\u4e0e\u5ef6\u8fdf\u4e4b\u95f4\u53d6\u5f97\u4e86\u5e73\u8861\u3002<\/p>\n<p>G1 \u8fdb\u4e00\u6b65\u5f15\u5165 Remembered Set&#xff08;RSet&#xff09;&#xff0c;\u6bcf\u4e2a region \u7ef4\u62a4\u6307\u5411\u81ea\u5df1\u7684\u5361\u8868\u96c6\u5408&#xff0c;\u5b9e\u73b0&#034;\u8c01\u6307\u5411\u6211&#034;\u7684\u53cd\u5411\u7d22\u5f15\u3002ZGC \u548c Shenandoah \u5219\u901a\u8fc7\u67d3\u8272\u6307\u9488\u4e0e\u5e76\u53d1\u6574\u7406\u89c4\u907f\u4e86\u5361\u8868\u7684\u90e8\u5206\u5f00\u9500\u3002<\/p>\n<h4>\u5176\u4ed6\u8bb0\u5fc6\u96c6\u5b9e\u73b0<\/h4>\n<p>\u9664\u5361\u8868\u5916&#xff0c;\u8bb0\u5fc6\u96c6\u8fd8\u6709\u51e0\u79cd\u5b9e\u73b0&#xff1a;<\/p>\n<ul>\n<li>\u5b57\u8282\u6570\u7ec4&#xff08;HotSpot \u5361\u8868&#xff09;&#xff1a;\u6bcf 512B \u4e00\u5b57\u8282\u3002<\/li>\n<li>\u4f4d\u56fe&#xff1a;\u6bcf\u4e2a\u5bf9\u8c61\u5bf9\u5e94\u4e00\u4e2a bit&#xff0c;\u66f4\u7cbe\u786e\u4f46\u66f4\u65b0\u6210\u672c\u9ad8\u3002<\/li>\n<li>\u5bf9\u8c61\u6570\u7ec4&#xff1a;\u7cbe\u786e\u8bb0\u5f55\u5f15\u7528\u5bf9\u8c61&#xff0c;\u5185\u5b58\u5360\u7528\u5927\u3002<\/li>\n<\/ul>\n<p>\u5361\u8868\u662f\u7cbe\u5ea6\u4e0e\u6210\u672c\u7684\u6298\u4e2d\u9009\u62e9&#xff0c;\u4e5f\u662f HotSpot \u957f\u671f\u6cbf\u7528\u7684\u65b9\u6848\u3002<\/p>\n<h3>\u5404\u7b97\u6cd5\u4f18\u7f3a\u70b9\u5bf9\u6bd4<\/h3>\n<table>\n<tr>\u7b97\u6cd5\u662f\u5426\u79fb\u52a8\u788e\u7247\u7a7a\u95f4\u5f00\u9500\u505c\u987f\u65f6\u95f4\u9002\u7528\u573a\u666f<\/tr>\n<tbody>\n<tr>\n<td>Mark-Sweep<\/td>\n<td>\u5426<\/td>\n<td>\u6709<\/td>\n<td>\u65e0\u989d\u5916\u5f00\u9500<\/td>\n<td>\u4e2d\u7b49<\/td>\n<td>\u8001\u5e74\u4ee3\u3001\u4f4e\u5ef6\u8fdf\u573a\u666f&#xff08;CMS&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>Copying<\/td>\n<td>\u662f<\/td>\n<td>\u65e0<\/td>\n<td>\u6d6a\u8d39\u4e00\u534a&#xff08;\u6216 10%&#xff09;<\/td>\n<td>\u77ed&#xff08;\u5b58\u6d3b\u5c11\u65f6&#xff09;<\/td>\n<td>\u65b0\u751f\u4ee3\u3001Survivor \u533a<\/td>\n<\/tr>\n<tr>\n<td>Mark-Compact<\/td>\n<td>\u662f<\/td>\n<td>\u65e0<\/td>\n<td>\u65e0\u989d\u5916\u5f00\u9500<\/td>\n<td>\u957f<\/td>\n<td>\u8001\u5e74\u4ee3\u3001\u541e\u5410\u91cf\u4f18\u5148<\/td>\n<\/tr>\n<tr>\n<td>Generational<\/td>\n<td>\u89c6\u4ee3\u800c\u5b9a<\/td>\n<td>\u89c6\u4ee3\u800c\u5b9a<\/td>\n<td>\u7efc\u5408\u53ef\u63a7<\/td>\n<td>\u7efc\u5408\u8f83\u4f18<\/td>\n<td>\u4e3b\u6d41 JVM \u9ed8\u8ba4\u7b56\u7565<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u9009\u62e9\u4f9d\u636e\u53ef\u4ee5\u5f52\u7eb3\u4e3a\u4e24\u6761\u4e3b\u7ebf&#xff1a;<\/p>\n<ul>\n<li>\u541e\u5410\u91cf\u4f18\u5148&#xff1a;\u9009\u62e9 Mark-Compact&#xff0c;\u505c\u987f\u957f\u4f46\u7a7a\u95f4\u5229\u7528\u7387\u9ad8\u3002<\/li>\n<li>\u5ef6\u8fdf\u4f18\u5148&#xff1a;\u9009\u62e9 Mark-Sweep \u6216\u590d\u5236\u7b97\u6cd5&#xff0c;\u505c\u987f\u77ed\u4f46\u6709\u788e\u7247\u6216\u7a7a\u95f4\u6d6a\u8d39\u3002<\/li>\n<\/ul>\n<p>\u73b0\u4ee3\u6536\u96c6\u5668&#xff08;G1\u3001ZGC\u3001Shenandoah&#xff09;\u901a\u8fc7\u5206\u533a&#xff08;Region&#xff09; &#043; \u5e76\u53d1\u6574\u7406\u6253\u7834\u4e86&#034;\u5fc5\u987b\u4e8c\u9009\u4e00&#034;\u7684\u56f0\u5c40&#xff0c;\u4f46\u5e95\u5c42\u4ecd\u4ee5\u8fd9\u56db\u79cd\u7b97\u6cd5\u4e3a\u6839\u57fa\u3002<\/p>\n<h3>\u4ee3\u7801\u793a\u4f8b&#xff1a;\u89c2\u5bdf\u4e0d\u540c\u7b97\u6cd5\u7684\u884c\u4e3a<\/h3>\n<p><span class=\"token comment\">\/**<br \/>\n * \u6f14\u793a\u5206\u4ee3 GC \u4e0b\u4e0d\u540c\u5bf9\u8c61\u7684\u751f\u547d\u5468\u671f<br \/>\n * \u9002\u7528 JDK 8\/11\/17<br \/>\n *<br \/>\n * \u8fd0\u884c\u53c2\u6570&#xff1a;<br \/>\n * java -Xms20m -Xmx20m -Xmn10m<br \/>\n *      -XX:SurvivorRatio&#061;8 -XX:&#043;UseSerialGC<br \/>\n *      -Xlog:gc* -cp MyApp GcAlgorithmDemo<br \/>\n *\/<\/span><br \/>\n<span class=\"token keyword\">public<\/span> <span class=\"token keyword\">class<\/span> <span class=\"token class-name\">GcAlgorithmDemo<\/span> <span class=\"token punctuation\">{<\/span><\/p>\n<p>    <span class=\"token keyword\">private<\/span> <span class=\"token keyword\">static<\/span> <span class=\"token keyword\">final<\/span> <span class=\"token keyword\">int<\/span> _1MB <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">1024<\/span> <span class=\"token operator\">*<\/span> <span class=\"token number\">1024<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>    <span class=\"token keyword\">public<\/span> <span class=\"token keyword\">static<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">main<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">String<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span> args<span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">throws<\/span> <span class=\"token class-name\">Exception<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token comment\">\/\/ \u77ed\u547d\u5bf9\u8c61&#xff0c;\u65b0\u751f\u4ee3\u4e2d\u5373\u88ab\u56de\u6536<\/span><br \/>\n        <span class=\"token keyword\">for<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token keyword\">int<\/span> i <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span> i <span class=\"token operator\">&lt;<\/span> <span class=\"token number\">100<\/span><span class=\"token punctuation\">;<\/span> i<span class=\"token operator\">&#043;&#043;<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n            <span class=\"token function\">allocateTransient<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token punctuation\">}<\/span><\/p>\n<p>        <span class=\"token comment\">\/\/ \u957f\u547d\u5bf9\u8c61&#xff0c;\u4f1a\u664b\u5347\u5230\u8001\u5e74\u4ee3<\/span><br \/>\n        <span class=\"token keyword\">byte<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span> longLived <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token keyword\">byte<\/span><span class=\"token punctuation\">[<\/span><span class=\"token number\">4<\/span> <span class=\"token operator\">*<\/span> _1MB<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>        <span class=\"token comment\">\/\/ \u518d\u5206\u914d\u4e00\u6279&#xff0c;\u89e6\u53d1 Minor GC<\/span><br \/>\n        <span class=\"token keyword\">for<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token keyword\">int<\/span> i <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span> i <span class=\"token operator\">&lt;<\/span> <span class=\"token number\">5<\/span><span class=\"token punctuation\">;<\/span> i<span class=\"token operator\">&#043;&#043;<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n            <span class=\"token keyword\">byte<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span> tmp <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token keyword\">byte<\/span><span class=\"token punctuation\">[<\/span><span class=\"token number\">2<\/span> <span class=\"token operator\">*<\/span> _1MB<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">;<\/span><br \/>\n            <span class=\"token class-name\">Thread<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">sleep<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">200<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><\/p>\n<p>    <span class=\"token keyword\">static<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">allocateTransient<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token keyword\">byte<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span> tmp <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token keyword\">byte<\/span><span class=\"token punctuation\">[<\/span><span class=\"token number\">512<\/span> <span class=\"token operator\">*<\/span> <span class=\"token number\">1024<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">;<\/span>   <span class=\"token comment\">\/\/ 512KB<\/span><br \/>\n        <span class=\"token comment\">\/\/ \u65b9\u6cd5\u8fd4\u56de&#xff0c;tmp \u5931\u53bb\u5f15\u7528&#xff0c;\u4e0b\u6b21 Minor GC \u5373\u88ab\u56de\u6536<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>JDK 11&#043; \u7684 GC \u65e5\u5fd7&#xff1a;<\/p>\n<p><span class=\"token function\">java<\/span> -Xlog:gc*<span class=\"token operator\">&#061;<\/span>info <span class=\"token parameter variable\">-cp<\/span> MyApp GcAlgorithmDemo<\/p>\n<p>\u8f93\u51fa\u4e2d\u53ef\u4ee5\u770b\u5230&#xff1a;<\/p>\n<ul>\n<li>GC(0) Pause Young (Allocation Failure) \u2014\u2014 \u65b0\u751f\u4ee3\u5206\u914d\u5931\u8d25\u89e6\u53d1 Minor GC&#xff0c;\u4f7f\u7528\u590d\u5236\u7b97\u6cd5\u3002<\/li>\n<li>\u540e\u7eed Pause Full \u8868\u793a\u664b\u5347\u5931\u8d25\u6216\u8001\u5e74\u4ee3\u7a7a\u95f4\u4e0d\u8db3&#xff0c;\u89e6\u53d1 Full GC&#xff0c;\u4f7f\u7528 Mark-Compact\u3002<\/li>\n<\/ul>\n<p>\u901a\u8fc7\u5bf9\u6bd4 -XX:&#043;UseSerialGC&#xff08;Mark-Compact \u8001\u5e74\u4ee3&#xff09;\u548c -XX:&#043;UseConcMarkSweepGC&#xff08;Mark-Sweep \u8001\u5e74\u4ee3&#xff09;\u7684\u65e5\u5fd7&#xff0c;\u53ef\u4ee5\u76f4\u89c2\u611f\u53d7\u4e24\u79cd\u7b97\u6cd5\u5728\u505c\u987f\u65f6\u95f4\u548c\u788e\u7247\u8868\u73b0\u4e0a\u7684\u5dee\u5f02\u3002<\/p>\n<h3>\u5b9e\u8df5\u8981\u70b9<\/h3>\n<p>1. \u4e0d\u8981\u76f2\u76ee\u6269\u5927\u65b0\u751f\u4ee3<\/p>\n<p>\u65b0\u751f\u4ee3\u8fc7\u5927\u4f1a\u8ba9 Minor GC \u5468\u671f\u53d8\u957f\u4f46\u5355\u6b21\u505c\u987f\u589e\u52a0&#xff1b;\u65b0\u751f\u4ee3\u8fc7\u5c0f\u5219 Minor GC \u9891\u7e41\u3001\u664b\u5347\u538b\u529b\u5927\u3002\u4e00\u822c\u5efa\u8bae\u65b0\u751f\u4ee3\u5360\u5806\u7684 1\/3 ~ 1\/2\u3002<\/p>\n<p>2. Survivor \u4e0d\u80fd\u592a\u5c0f<\/p>\n<p>Survivor \u592a\u5c0f\u4f1a\u5bfc\u81f4\u5b58\u6d3b\u5bf9\u8c61\u653e\u4e0d\u4e0b&#xff0c;\u76f4\u63a5\u664b\u5347\u8001\u5e74\u4ee3&#xff0c;\u9020\u6210&#034;\u8fc7\u65e9\u664b\u5347&#034;\u3002\u76d1\u63a7 -XX:&#043;PrintAdaptiveSizePolicy&#xff08;JDK 8&#xff09;\u6216 -Xlog:gc&#043;ergo&#xff08;JDK 11&#043;&#xff09;\u53ef\u770b\u5230 JVM \u52a8\u6001\u8c03\u6574 Survivor \u5927\u5c0f\u7684\u8fc7\u7a0b\u3002<\/p>\n<p>3. CMS \u7684\u788e\u7247\u4ee3\u4ef7<\/p>\n<p>CMS \u91c7\u7528 Mark-Sweep&#xff0c;\u957f\u671f\u8fd0\u884c\u540e\u788e\u7247\u4f1a\u89e6\u53d1\u5e76\u53d1\u6a21\u5f0f\u5931\u8d25&#xff08;Concurrent Mode Failure&#xff09;&#xff0c;\u9000\u5316\u4e3a Serial Old \u7684 Mark-Compact Full GC&#xff0c;\u505c\u987f\u53ef\u80fd\u8fbe\u5230\u79d2\u7ea7\u3002\u8fd9\u662f CMS \u88ab G1 \u53d6\u4ee3\u7684\u5173\u952e\u539f\u56e0\u3002<\/p>\n<p>4. G1 \u7684&#034;\u6df7\u5408\u56de\u6536&#034;\u672c\u8d28<\/p>\n<p>G1 \u7684 Mixed GC \u65e2\u56de\u6536 Young Region \u53c8\u56de\u6536\u90e8\u5206 Old Region&#xff0c;\u76f8\u5f53\u4e8e\u628a\u5206\u4ee3\u6536\u96c6\u4e0e\u5206\u533a\u7ed3\u5408\u3002\u7406\u89e3\u4e86 Copying &#043; \u5361\u8868&#xff0c;\u518d\u770b G1 \u4f1a\u987a\u7406\u6210\u7ae0\u3002<\/p>\n<p>5. \u76d1\u63a7\u5bf9\u8c61\u664b\u5347\u901f\u7387<\/p>\n<p>\u901a\u8fc7 jstat -gc &lt;pid&gt; 1s \u89c2\u5bdf\u8001\u5e74\u4ee3\u4f7f\u7528\u91cf\u589e\u957f\u901f\u7387\u3002\u5982\u679c\u589e\u957f\u8fc7\u5feb&#xff0c;\u8bf4\u660e\u77ed\u547d\u5bf9\u8c61\u9003\u9038\u5230\u4e86\u8001\u5e74\u4ee3&#xff0c;\u5e94\u6392\u67e5 Survivor \u914d\u7f6e\u6216\u5927\u5bf9\u8c61\u9608\u503c -XX:PretenureSizeThreshold\u3002<\/p>\n<h3>\u5c0f\u7ed3<\/h3>\n<ul>\n<li>Mark-Sweep&#xff1a;\u5b9e\u73b0\u7b80\u5355&#xff0c;\u4f46\u4ea7\u751f\u788e\u7247&#xff0c;\u9002\u5408\u4f4e\u5ef6\u8fdf\u573a\u666f\u3002<\/li>\n<li>Copying&#xff1a;\u65e0\u788e\u7247\u3001\u5206\u914d\u5feb&#xff0c;\u4f46\u6d6a\u8d39\u7a7a\u95f4&#xff0c;\u9002\u5408\u65b0\u751f\u4ee3\u3002<\/li>\n<li>Mark-Compact&#xff1a;\u65e0\u788e\u7247\u3001\u7a7a\u95f4\u5229\u7528\u7387\u9ad8&#xff0c;\u4f46\u505c\u987f\u957f&#xff0c;\u9002\u5408\u8001\u5e74\u4ee3\u3002<\/li>\n<li>Generational&#xff1a;\u57fa\u4e8e\u5f31\u4ee3\u5047\u8bf4&#xff0c;\u5206\u800c\u6cbb\u4e4b&#xff0c;\u662f\u4e3b\u6d41 JVM \u7684\u57fa\u7840\u6846\u67b6\u3002<\/li>\n<li>\u5361\u8868\u901a\u8fc7\u5199\u5c4f\u969c\u8bb0\u5f55\u8de8\u4ee3\u5f15\u7528&#xff0c;\u628a&#034;\u5168\u626b\u8001\u5e74\u4ee3&#034;\u964d\u4e3a&#034;\u53ea\u626b\u810f\u5361&#034;&#xff0c;\u662f\u5206\u4ee3\u6536\u96c6\u7684\u5173\u952e\u652f\u6491\u3002<\/li>\n<\/ul>\n<p>\u4e0b\u4e00\u7bc7\u6211\u4eec\u5c06\u8fdb\u5165\u5177\u4f53\u7684\u6536\u96c6\u5668\u5b9e\u73b0&#xff0c;\u5148\u770b\u6700\u65e9\u51fa\u73b0\u3001\u4e5f\u6700\u7b80\u5355\u7684\u4e24\u4e2a&#xff1a;Serial \u4e0e ParNew\u3002<\/p>\n<p>\u66f4\u591a\u5185\u5bb9&#xff1a;JVM\u8c03\u4f18\u5b9e\u6218<\/p>\n","protected":false},"excerpt":{"rendered":"<p>24-\u5783\u573e\u56de\u6536\u7b97\u6cd5&#xff1a;\u6807\u8bb0-\u6e05\u9664\u3001\u590d\u5236\u3001\u6574\u7406\u4e0e\u5206\u4ee3<br \/>\n\u77e5\u9053\u4e86\\&#8221;\u54ea\u4e9b\u5bf9\u8c61\u6d3b\u7740\u3001\u54ea\u4e9b\u8be5\u6b7b\\&#8221;&#xff0c;\u4e0b\u4e00\u6b65\u5c31\u662f\\&#8221;\u5982\u4f55\u9ad8\u6548\u56de\u6536\u6b7b\u5bf9\u8c61\\&#8221;\u3002GC \u7b97\u6cd5\u7ecf\u8fc7\u51e0\u5341\u5e74\u7684\u6f14\u5316&#xff0c;\u6c89\u6dc0\u51fa\u56db\u79cd\u57fa\u7840\u8303\u5f0f&#xff1a;Mark-Sweep&#xff08;\u6807\u8bb0-\u6e05\u9664&#xff09;\u3001Copying&#xff08;\u590d\u5236&#xff09;\u3001Mark-Compact&#xff08;\u6807\u8bb0-\u6574\u7406&#xff09; \u548c Generational&#xff08;\u5206\u4ee3\u6536\u96c6&#xff09;\u3002\u672c<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[426,427],"topic":[],"class_list":["post-87859","post","type-post","status-publish","format-standard","hentry","category-server","tag-jvm","tag-427"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u3010JVM\u539f\u7406\u8be6\u89e3\u301124-\u5783\u573e\u56de\u6536\u7b97\u6cd5-\u6807\u8bb0\u6e05\u9664\u590d\u5236\u6574\u7406\u5206\u4ee3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/87859.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u3010JVM\u539f\u7406\u8be6\u89e3\u301124-\u5783\u573e\u56de\u6536\u7b97\u6cd5-\u6807\u8bb0\u6e05\u9664\u590d\u5236\u6574\u7406\u5206\u4ee3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"24-\u5783\u573e\u56de\u6536\u7b97\u6cd5&#xff1a;\u6807\u8bb0-\u6e05\u9664\u3001\u590d\u5236\u3001\u6574\u7406\u4e0e\u5206\u4ee3 \u77e5\u9053\u4e86&quot;\u54ea\u4e9b\u5bf9\u8c61\u6d3b\u7740\u3001\u54ea\u4e9b\u8be5\u6b7b&quot;&#xff0c;\u4e0b\u4e00\u6b65\u5c31\u662f&quot;\u5982\u4f55\u9ad8\u6548\u56de\u6536\u6b7b\u5bf9\u8c61&quot;\u3002GC \u7b97\u6cd5\u7ecf\u8fc7\u51e0\u5341\u5e74\u7684\u6f14\u5316&#xff0c;\u6c89\u6dc0\u51fa\u56db\u79cd\u57fa\u7840\u8303\u5f0f&#xff1a;Mark-Sweep&#xff08;\u6807\u8bb0-\u6e05\u9664&#xff09;\u3001Copying&#xff08;\u590d\u5236&#xff09;\u3001Mark-Compact&#xff08;\u6807\u8bb0-\u6574\u7406&#xff09; \u548c Generational&#xff08;\u5206\u4ee3\u6536\u96c6&#xff09;\u3002\u672c\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/87859.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-07-30T17:00:30+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/87859.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/87859.html\",\"name\":\"\u3010JVM\u539f\u7406\u8be6\u89e3\u301124-\u5783\u573e\u56de\u6536\u7b97\u6cd5-\u6807\u8bb0\u6e05\u9664\u590d\u5236\u6574\u7406\u5206\u4ee3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-07-30T17:00:30+00:00\",\"dateModified\":\"2026-07-30T17:00:30+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/87859.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/87859.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/87859.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u3010JVM\u539f\u7406\u8be6\u89e3\u301124-\u5783\u573e\u56de\u6536\u7b97\u6cd5-\u6807\u8bb0\u6e05\u9664\u590d\u5236\u6574\u7406\u5206\u4ee3\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u3010JVM\u539f\u7406\u8be6\u89e3\u301124-\u5783\u573e\u56de\u6536\u7b97\u6cd5-\u6807\u8bb0\u6e05\u9664\u590d\u5236\u6574\u7406\u5206\u4ee3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/87859.html","og_locale":"zh_CN","og_type":"article","og_title":"\u3010JVM\u539f\u7406\u8be6\u89e3\u301124-\u5783\u573e\u56de\u6536\u7b97\u6cd5-\u6807\u8bb0\u6e05\u9664\u590d\u5236\u6574\u7406\u5206\u4ee3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"24-\u5783\u573e\u56de\u6536\u7b97\u6cd5&#xff1a;\u6807\u8bb0-\u6e05\u9664\u3001\u590d\u5236\u3001\u6574\u7406\u4e0e\u5206\u4ee3 \u77e5\u9053\u4e86\"\u54ea\u4e9b\u5bf9\u8c61\u6d3b\u7740\u3001\u54ea\u4e9b\u8be5\u6b7b\"&#xff0c;\u4e0b\u4e00\u6b65\u5c31\u662f\"\u5982\u4f55\u9ad8\u6548\u56de\u6536\u6b7b\u5bf9\u8c61\"\u3002GC \u7b97\u6cd5\u7ecf\u8fc7\u51e0\u5341\u5e74\u7684\u6f14\u5316&#xff0c;\u6c89\u6dc0\u51fa\u56db\u79cd\u57fa\u7840\u8303\u5f0f&#xff1a;Mark-Sweep&#xff08;\u6807\u8bb0-\u6e05\u9664&#xff09;\u3001Copying&#xff08;\u590d\u5236&#xff09;\u3001Mark-Compact&#xff08;\u6807\u8bb0-\u6574\u7406&#xff09; \u548c Generational&#xff08;\u5206\u4ee3\u6536\u96c6&#xff09;\u3002\u672c","og_url":"https:\/\/www.wsisp.com\/helps\/87859.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-07-30T17:00:30+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/87859.html","url":"https:\/\/www.wsisp.com\/helps\/87859.html","name":"\u3010JVM\u539f\u7406\u8be6\u89e3\u301124-\u5783\u573e\u56de\u6536\u7b97\u6cd5-\u6807\u8bb0\u6e05\u9664\u590d\u5236\u6574\u7406\u5206\u4ee3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-07-30T17:00:30+00:00","dateModified":"2026-07-30T17:00:30+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/87859.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/87859.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/87859.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u3010JVM\u539f\u7406\u8be6\u89e3\u301124-\u5783\u573e\u56de\u6536\u7b97\u6cd5-\u6807\u8bb0\u6e05\u9664\u590d\u5236\u6574\u7406\u5206\u4ee3"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/87859","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=87859"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/87859\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=87859"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=87859"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=87859"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=87859"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}