{"id":35689,"date":"2024-11-26T17:45:55","date_gmt":"2024-11-26T09:45:55","guid":{"rendered":"https:\/\/fwq.ai\/blog\/35689\/"},"modified":"2024-11-26T17:45:55","modified_gmt":"2024-11-26T09:45:55","slug":"java-%e4%b8%ad%e7%9a%84%e5%ae%89%e5%85%a8%e7%82%b9%e5%92%8c%e5%ae%89%e5%85%a8%e5%8c%ba%e5%9f%9f%e6%98%af%e5%a6%82%e4%bd%95%e6%8f%90%e9%ab%98-gc-%e6%95%88%e7%8e%87%e7%9a%84%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/35689\/","title":{"rendered":"Java \u4e2d\u7684\u5b89\u5168\u70b9\u548c\u5b89\u5168\u533a\u57df\u662f\u5982\u4f55\u63d0\u9ad8 GC \u6548\u7387\u7684\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173069766747240.jpg\" class=\"aligncenter\" title=\"Java \u4e2d\u7684\u5b89\u5168\u70b9\u548c\u5b89\u5168\u533a\u57df\u662f\u5982\u4f55\u63d0\u9ad8 GC \u6548\u7387\u7684\uff1f\u63d2\u56fe\" alt=\"Java \u4e2d\u7684\u5b89\u5168\u70b9\u548c\u5b89\u5168\u533a\u57df\u662f\u5982\u4f55\u63d0\u9ad8 GC \u6548\u7387\u7684\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>Java \u4e2d\u7684\u5b89\u5168\u70b9\u4e0e\u5b89\u5168\u533a\u57df<\/strong><\/p>\n<p>\u5728 Java \u4e2d\uff0c\u5783\u573e\u56de\u6536 (GC) \u8fc7\u7a0b\u4e2d\u4f1a\u8fdb\u5165 STW (Stop-the-World) \u72b6\u6001\uff0c\u6b64\u65f6\u6240\u6709\u7ebf\u7a0b\u505c\u6b62\u6267\u884c\uff0c\u76f4\u5230 GC \u64cd\u4f5c\u5b8c\u6210\u3002<\/p>\n<p>\u4e3a\u4e86\u964d\u4f4e STW \u5bf9\u5e94\u7528\u6027\u80fd\u7684\u5f71\u54cd\uff0cJava \u5f15\u5165\u4e86\u5b89\u5168\u70b9\u548c\u5b89\u5168\u533a\u57df\u7684\u6982\u5ff5\u3002<\/p>\n<p><strong>\u5b89\u5168\u70b9<\/strong><\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<p>\u5b89\u5168\u70b9\u662f\u6307\u4ee3\u7801\u6267\u884c\u5230\u67d0\u4e9b JVM \u8ba4\u4e3a\u5b89\u5168\u7684\u7279\u5b9a\u4f4d\u7f6e\u540e\uff0c\u624d\u80fd\u8fdb\u5165 STW \u72b6\u6001\u3002\u8fd9\u4e9b\u5b89\u5168\u4f4d\u7f6e\u901a\u5e38\u5728\u65b9\u6cd5\u8c03\u7528\u3001\u5faa\u73af\u6267\u884c\u3001\u5f02\u5e38\u5904\u7406\u7b49\u4ee3\u7801\u533a\u57df\u3002<\/p>\n<p>\u5f53\u7ebf\u7a0b\u6267\u884c\u5230\u5b89\u5168\u70b9\u65f6\uff0c\u5982\u679c JVM \u51c6\u5907\u8fdb\u884c GC\uff0c\u5b83\u4f1a\u5c06\u7ebf\u7a0b\u6682\u505c\u5728\u5b89\u5168\u70b9\u5904\u3002\u6b64\u65f6\uff0cJVM \u53ef\u4ee5\u626b\u63cf\u8be5\u7ebf\u7a0b\u7684\u6808\u5e27\uff0c\u8bc6\u522b\u51fa\u6709\u5f15\u7528\u7684\u5bf9\u8c61\u3002<\/p>\n<p><strong>\u5b89\u5168\u533a\u57df<\/strong><\/p>\n<p>\u5b89\u5168\u533a\u57df\u662f\u6307\u4e00\u6bb5\u4ee3\u7801\uff0c\u5728\u6267\u884c\u671f\u95f4\u4e0d\u4f1a\u53d1\u751f\u4efb\u4f55\u5bf9\u8c61\u5206\u914d\u6216\u6307\u9488\u66f4\u65b0\u3002\u5f53\u7ebf\u7a0b\u8fdb\u5165\u5b89\u5168\u533a\u57df\u65f6\uff0cJVM \u53ef\u4ee5\u653e\u5fc3\u5730\u89e6\u53d1 GC\uff0c\u800c\u4e0d\u4f1a\u4e2d\u65ad\u8be5\u7ebf\u7a0b\u7684\u6267\u884c\u3002<\/p>\n<p>\u901a\u8fc7\u5f15\u5165\u5b89\u5168\u70b9\u548c\u5b89\u5168\u533a\u57df\uff0cJVM \u53ef\u4ee5\u4ec5\u5728\u9700\u8981\u65f6\u6682\u505c\u7ebf\u7a0b\uff0c\u4ece\u800c\u51cf\u5c11 STW \u7684\u6301\u7eed\u65f6\u95f4\uff0c\u5e76\u63d0\u9ad8\u5e94\u7528\u7a0b\u5e8f\u7684\u6027\u80fd\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fJava \u4e2d\u7684\u5b89\u5168\u70b9\u548c\u5b89\u5168\u533a\u57df\u662f\u5982\u4f55\u63d0\u9ad8 GC \u6548\u7387\u7684\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Java \u4e2d\u7684\u5b89\u5168\u70b9\u4e0e\u5b89\u5168\u533a\u57df \u5728 Java \u4e2d\uff0c\u5783\u573e\u56de\u6536 (GC) \u8fc7\u7a0b\u4e2d\u4f1a\u8fdb\u5165 STW (Stop-the-World) \u72b6\u6001\uff0c\u6b64\u65f6\u6240\u6709\u7ebf\u7a0b\u505c\u6b62\u6267\u884c\uff0c\u76f4\u5230 GC \u64cd\u4f5c\u5b8c\u6210\u3002 \u4e3a\u4e86\u964d\u4f4e STW \u5bf9\u5e94\u7528\u6027\u80fd\u7684\u5f71\u54cd\uff0cJava \u5f15\u5165\u4e86\u5b89\u5168\u70b9\u548c\u5b89\u5168\u533a\u57df\u7684\u6982\u5ff5\u3002 \u5b89\u5168\u70b9 \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b \u5b89\u5168\u70b9\u662f\u6307\u4ee3\u7801\u6267\u884c\u5230\u67d0\u4e9b JVM \u8ba4\u4e3a\u5b89\u5168\u7684\u7279\u5b9a\u4f4d\u7f6e\u540e\uff0c\u624d\u80fd\u8fdb\u5165 STW \u72b6\u6001\u3002\u8fd9\u4e9b\u5b89\u5168\u4f4d\u7f6e\u901a\u5e38\u5728\u65b9\u6cd5\u8c03\u7528\u3001\u5faa\u73af\u6267\u884c\u3001\u5f02\u5e38\u5904\u7406\u7b49\u4ee3\u7801\u533a\u57df\u3002 \u5f53\u7ebf\u7a0b\u6267\u884c\u5230\u5b89\u5168\u70b9\u65f6\uff0c\u5982\u679c JVM \u51c6\u5907\u8fdb\u884c GC\uff0c\u5b83\u4f1a\u5c06\u7ebf\u7a0b\u6682\u505c\u5728\u5b89\u5168\u70b9\u5904\u3002\u6b64\u65f6\uff0cJVM \u53ef\u4ee5\u626b\u63cf\u8be5\u7ebf\u7a0b\u7684\u6808\u5e27\uff0c\u8bc6\u522b\u51fa\u6709\u5f15\u7528\u7684\u5bf9\u8c61\u3002 \u5b89\u5168\u533a\u57df \u5b89\u5168\u533a\u57df\u662f\u6307\u4e00\u6bb5\u4ee3\u7801\uff0c\u5728\u6267\u884c\u671f\u95f4\u4e0d\u4f1a\u53d1\u751f\u4efb\u4f55\u5bf9\u8c61\u5206\u914d\u6216\u6307\u9488\u66f4\u65b0\u3002\u5f53\u7ebf\u7a0b\u8fdb\u5165\u5b89\u5168\u533a\u57df\u65f6\uff0cJVM \u53ef\u4ee5\u653e\u5fc3\u5730\u89e6\u53d1 GC\uff0c\u800c\u4e0d\u4f1a\u4e2d\u65ad\u8be5\u7ebf\u7a0b\u7684\u6267\u884c\u3002 \u901a\u8fc7\u5f15\u5165\u5b89\u5168\u70b9\u548c\u5b89\u5168\u533a\u57df\uff0cJVM \u53ef\u4ee5\u4ec5\u5728\u9700\u8981\u65f6\u6682\u505c\u7ebf\u7a0b\uff0c\u4ece\u800c\u51cf\u5c11 STW \u7684\u6301\u7eed\u65f6\u95f4\uff0c\u5e76\u63d0\u9ad8\u5e94\u7528\u7a0b\u5e8f\u7684\u6027\u80fd\u3002 \u4ee5\u4e0a\u5c31\u662fJava \u4e2d\u7684\u5b89\u5168\u70b9\u548c\u5b89\u5168\u533a\u57df\u662f\u5982\u4f55\u63d0\u9ad8 GC \u6548\u7387\u7684\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-35689","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/35689","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=35689"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/35689\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=35689"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=35689"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=35689"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}