{"id":203401,"date":"2025-05-22T13:34:15","date_gmt":"2025-05-22T05:34:15","guid":{"rendered":"https:\/\/server.hk\/cnblog\/203401\/"},"modified":"2025-05-22T13:34:15","modified_gmt":"2025-05-22T05:34:15","slug":"java-%e4%b8%ad-minorgc%e3%80%81majorgc-%e5%92%8c-fullgc-%e5%88%86%e5%88%ab%e5%9c%a8%e4%bb%80%e4%b9%88%e6%83%85%e5%86%b5%e4%b8%8b%e8%a7%a6%e5%8f%91%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/203401\/","title":{"rendered":"Java \u4e2d MinorGC\u3001MajorGC \u548c FullGC \u5206\u522b\u5728\u4ec0\u4e48\u60c5\u51b5\u4e0b\u89e6\u53d1\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>Java \u4e2d MinorGC\u3001MajorGC \u548c FullGC \u5206\u522b\u5728\u4ec0\u4e48\u60c5\u51b5\u4e0b\u89e6\u53d1\uff1f<\/h1>\n<p>\u7f16\u7a0b\u5e76\u4e0d\u662f\u4e00\u4e2a\u673a\u68b0\u6027\u7684\u5de5\u4f5c\uff0c\u800c\u662f\u9700\u8981\u6709\u601d\u8003\uff0c\u6709\u521b\u65b0\u7684\u5de5\u4f5c\uff0c\u8bed\u6cd5\u662f\u56fa\u5b9a\u7684\uff0c\u4f46\u89e3\u51b3\u95ee\u9898\u7684\u601d\u8def\u5219\u662f\u4f9d\u9760\u4eba\u7684\u601d\u7ef4\uff0c\u8fd9\u5c31\u9700\u8981\u6211\u4eec\u575a\u6301\u5b66\u4e60\u548c\u66f4\u65b0\u81ea\u5df1\u7684\u77e5\u8bc6\u3002\u4eca\u5929\u5c31\u6574\u7406\u5206\u4eab\u300aJava \u4e2d MinorGC\u3001MajorGC \u548c FullGC \u5206\u522b\u5728\u4ec0\u4e48\u60c5\u51b5\u4e0b\u89e6\u53d1\uff1f\u300b\uff0c\u6587\u7ae0\u8bb2\u89e3\u7684\u77e5\u8bc6\u70b9\u4e3b\u8981\u5305\u62ec\uff0c\u5982\u679c\u4f60\u5bf9\u6587\u7ae0\u65b9\u9762\u7684\u77e5\u8bc6\u70b9\u611f\u5174\u8da3\uff0c\u5c31\u4e0d\u8981\u9519\u8fc7\uff0c\u5728\u8fd9\u53ef\u4ee5\u5bf9\u5927\u5bb6\u7684\u77e5\u8bc6\u79ef\u7d2f\u6709\u6240\u5e2e\u52a9\uff0c\u52a9\u529b\u5f00\u53d1\u80fd\u529b\u7684\u63d0\u5347\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241107\/1730957450672c508aa6ee5.jpg\" class=\"aligncenter\"><\/p>\n<p><strong>\u5728 Java \u4e2d\uff0cMinorGC\u3001MajorGC \u548c FullGC \u7684\u89e6\u53d1\u65f6\u673a<\/strong><\/p>\n<p>\u5728 Java \u865a\u62df\u673a (JVM) \u7684\u5783\u573e\u56de\u6536\u8fc7\u7a0b\u4e2d\uff0c\u4f1a\u53d1\u751f\u4e09\u79cd\u7c7b\u578b\u7684\u5783\u573e\u56de\u6536\u4e8b\u4ef6\uff1aMinorGC\u3001MajorGC \u548c FullGC\u3002\u8fd9\u4e9b\u4e8b\u4ef6\u6309\u7167\u4e0d\u540c\u7684\u89e6\u53d1\u6761\u4ef6\u53d1\u751f\u3002<\/p>\n<p><strong>MinorGC<\/strong><\/p>\n<p>MinorGC \u53d1\u751f\u5728\u5e74\u8f7b\u4ee3\u7a7a\u95f4\u4e0d\u8db3\u4ee5\u5206\u914d\u65b0\u5bf9\u8c61\u65f6\u3002\u5e74\u8f7b\u4ee3\u662f JVM \u4e2d\u5206\u914d\u7ed9\u77ed\u6682\u751f\u5b58\u5bf9\u8c61\uff08\u4f8b\u5982\u5c40\u90e8\u53d8\u91cf\uff09\u7684\u7a7a\u95f4\u3002\u5f53\u5e74\u8f7b\u4ee3\u7a7a\u95f4\u5df2\u6ee1\uff0c\u5c31\u4f1a\u89e6\u53d1 MinorGC \u4ee5\u56de\u6536\u4e0d\u518d\u4f7f\u7528\u7684\u5bf9\u8c61\u3002<\/p>\n<p><strong>MajorGC<\/strong><\/p>\n<p>MajorGC \u6307\u7684\u662f\u53d1\u751f\u5728\u8001\u5e74\u4ee3\u7684\u5783\u573e\u56de\u6536\u4e8b\u4ef6\u3002\u8001\u5e74\u4ee3\u662f JVM \u4e2d\u5206\u914d\u7ed9\u957f\u671f\u751f\u5b58\u5bf9\u8c61\uff08\u4f8b\u5982\u9759\u6001\u53d8\u91cf\uff09\u7684\u7a7a\u95f4\u3002MajorGC \u901a\u5e38\u4f34\u968f\u7740 MinorGC \u53d1\u751f\u3002\u5f53\u5e74\u8f7b\u4ee3\u4e2d\u7684\u5bf9\u8c61\u664b\u5347\u5230\u8001\u5e74\u4ee3\u5e76\u4f7f\u8001\u5e74\u4ee3\u7a7a\u95f4\u4e0d\u8db3\u65f6\uff0c\u5c31\u4f1a\u89e6\u53d1 MajorGC\u3002<\/p>\n<p><strong>FullGC<\/strong><\/p>\n<p>FullGC \u662f\u6307\u5bf9\u6574\u4e2a\u5806\u7a7a\u95f4\uff08\u5305\u62ec\u5e74\u8f7b\u4ee3\u548c\u8001\u5e74\u4ee3\uff09\u8fdb\u884c\u7684\u5783\u573e\u56de\u6536\u3002FullGC \u7684\u89e6\u53d1\u6761\u4ef6\u5305\u62ec\uff1a<\/p>\n<ul>\n<li>\u8001\u5e74\u4ee3\u65e0\u6cd5\u518d\u5206\u914d\u5185\u5b58\u3002<\/li>\n<li>\u5143\u7a7a\u95f4\u4e0d\u8db3\uff08\u5143\u7a7a\u95f4\u662f\u5b58\u653e\u7c7b\u5143\u6570\u636e\u7684\u7a7a\u95f4\uff09\u3002<\/li>\n<li>\u663e\u5f0f\u8c03\u7528 System.gc \u65b9\u6cd5\u3002<\/li>\n<li>\u4f7f\u7528 CMS \u4e4b\u7c7b\u7684\u5783\u573e\u56de\u6536\u5668\u65f6\uff0cMinorGC \u51fa\u73b0 promotion failure\uff08\u664b\u5347\u5931\u8d25\uff09\u3002<\/li>\n<\/ul>\n<p>\u7406\u8bba\u8981\u638c\u63e1\uff0c\u5b9e\u64cd\u4e0d\u80fd\u843d\uff01\u4ee5\u4e0a\u5173\u4e8e\u300aJava \u4e2d MinorGC\u3001MajorGC \u548c FullGC \u5206\u522b\u5728\u4ec0\u4e48\u60c5\u51b5\u4e0b\u89e6\u53d1\uff1f\u300b\u7684\u8be6\u7ec6\u4ecb\u7ecd\uff0c\u5927\u5bb6\u90fd\u638c\u63e1\u4e86\u5427\uff01\u5982\u679c\u60f3\u8981\u7ee7\u7eed\u63d0\u5347\u81ea\u5df1\u7684\u80fd\u529b\uff0c\u90a3\u4e48\u5c31\u6765\u5173\u6ce8\u516c\u4f17\u53f7\u5427\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Java \u4e2d MinorGC\u3001M&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4925],"tags":[],"class_list":["post-203401","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/203401","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=203401"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/203401\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=203401"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=203401"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=203401"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}