{"id":58828,"date":"2023-10-26T21:51:48","date_gmt":"2023-10-26T13:51:48","guid":{"rendered":"https:\/\/docs.pingcode.com\/?p=58828"},"modified":"2023-10-26T22:00:07","modified_gmt":"2023-10-26T14:00:07","slug":"gc-%e7%ae%97%e6%b3%95%ef%bc%8c%e6%b0%b8%e4%b9%85%e4%bb%a3%e5%af%b9%e8%b1%a1%e5%a6%82%e4%bd%95-gc-%ef%bc%8c-gc-%e6%9c%89%e7%8e%af%e6%80%8e%e4%b9%88%e5%a4%84%e7%90%86","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/58828.html","title":{"rendered":"GC \u7b97\u6cd5\uff0c\u6c38\u4e45\u4ee3\u5bf9\u8c61\u5982\u4f55 GC \uff0c GC \u6709\u73af\u600e\u4e48\u5904\u7406"},"content":{"rendered":"\n<blockquote class=\"wp-block-quote\">\n<p>\u4e86\u89e3 GC (\u5783\u573e\u6536\u96c6) \u7b97\u6cd5\u662f\u6bcf\u4f4d Java \u5f00\u53d1\u8005\u7684\u5fc5\u4fee\u8bfe\u3002\u672c\u6587\u5c06\u8be6\u7ec6\u89e3\u6790 GC \u7b97\u6cd5\u7684\u5de5\u4f5c\u539f\u7406\u3001\u5982\u4f55\u5904\u7406\u6c38\u4e45\u4ee3\u5bf9\u8c61\uff0c\u4ee5\u53ca\u9762\u5bf9\u5f15\u7528\u73af\u5982\u4f55\u6709\u6548\u6267\u884c GC\u3002\u6df1\u5165\u6d45\u51fa\u7684\u89e3\u6790\uff0c\u5e26\u4f60\u5168\u9762\u7406\u89e3 GC \u7684\u795e\u79d8\u4e4b\u5904\u3002<\/p>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>1.GC <\/strong><strong>\u7b97\u6cd5\u7b80\u4ecb<\/strong><\/h2>\n\n\n\n<p>\u5783\u573e\u6536\u96c6(GC)\u662f Java \u865a\u62df\u673a(JVM)\u7684\u6838\u5fc3\u7ec4\u4ef6\uff0c\u7528\u4e8e\u81ea\u52a8\u68c0\u6d4b\u548c\u56de\u6536\u4e0d\u518d\u4f7f\u7528\u7684\u5bf9\u8c61\uff0c\u4ece\u800c\u91ca\u653e\u5185\u5b58\u3002\u5176\u5de5\u4f5c\u539f\u7406\u57fa\u4e8e\u51e0\u79cd\u4e3b\u8981\u7684\u7b97\u6cd5\uff0c\u4f8b\u5982\u6807\u8bb0-\u6e05\u9664\u3001\u6807\u8bb0-\u6574\u7406\u548c\u590d\u5236\u7b97\u6cd5\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>2.<\/strong><strong>\u6c38\u4e45\u4ee3\u5bf9\u8c61\u5982\u4f55 GC<\/strong><\/h2>\n\n\n\n<p>\u6c38\u4e45\u4ee3(\u6216\u5728\u67d0\u4e9b JVM \u7248\u672c\u4e2d\u79f0\u4e3a\u5143\u7a7a\u95f4)\u4e3b\u8981\u5b58\u50a8 JVM \u7684\u5143\u6570\u636e\uff0c\u4f8b\u5982\u7c7b\u7684\u5b9a\u4e49\u3002\u5f53\u8fd9\u4e9b\u5bf9\u8c61\u4e0d\u518d\u88ab\u5f15\u7528\u65f6\uff0cGC \u4e5f\u4f1a\u56de\u6536\u5b83\u4eec\u3002\u901a\u5e38\uff0cFull GC \u4f1a\u6d89\u53ca\u6c38\u4e45\u4ee3\u7684\u6e05\u7406\u3002\u968f\u7740 Java \u7684\u7248\u672c\u66f4\u65b0\uff0c\u6c38\u4e45\u4ee3\u7684\u6982\u5ff5\u548c\u5783\u573e\u56de\u6536\u65b9\u5f0f\u4e5f\u5728\u53d8\u5316\uff0c\u4f8b\u5982\uff0cJava 8 \u5f15\u5165\u7684\u5143\u7a7a\u95f4\u53d6\u4ee3\u4e86\u4f20\u7edf\u7684\u6c38\u4e45\u4ee3\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>3.GC <\/strong><strong>\u4e2d\u7684\u5f15\u7528\u73af\u5904\u7406<\/strong><\/h2>\n\n\n\n<p>\u5f88\u591a\u65b0\u624b\u5f00\u53d1\u8005\u90fd\u4f1a\u8bef\u8ba4\u4e3a\u5bf9\u8c61\u95f4\u7684\u4e92\u76f8\u5f15\u7528\uff08\u5f15\u7528\u73af\uff09\u4f1a\u963b\u6b62 GC \u7684\u5de5\u4f5c\u3002\u5b9e\u9645\u4e0a\uff0cJVM \u4f7f\u7528\u6839\u53ef\u8fbe\u6027\u7b97\u6cd5\u6765\u786e\u5b9a\u5bf9\u8c61\u662f\u5426\u8fd8\u5728\u4f7f\u7528\u3002\u7b80\u5355\u6765\u8bf4\uff0c\u5982\u679c\u4e00\u4e2a\u5bf9\u8c61\u4ece\u6839\u5bf9\u8c61\u5f00\u59cb\u65e0\u6cd5\u5230\u8fbe\uff0c\u90a3\u4e48\u8fd9\u4e2a\u5bf9\u8c61\u5c31\u88ab\u89c6\u4e3a\u5783\u573e\uff0c\u5373\u4f7f\u8be5\u5bf9\u8c61\u53c2\u4e0e\u4e86\u5f15\u7528\u73af\u3002\u56e0\u6b64\uff0c\u5f15\u7528\u73af\u4e0d\u4f1a\u963b\u6b62\u5bf9\u8c61\u88ab GC\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>4.GC \u7684\u4f18\u5316\u7b56\u7565<\/strong><\/h2>\n\n\n\n<p>\u4e3a\u4e86\u63d0\u9ad8 GC \u7684\u6548\u7387\uff0c\u53ef\u4ee5\u91c7\u7528\u5404\u79cd\u4f18\u5316\u7b56\u7565\u3002\u4f8b\u5982\uff0c\u8c03\u6574\u5806\u7684\u5927\u5c0f\u3001\u9009\u62e9\u5408\u9002\u7684 GC \u7b97\u6cd5\u6216\u8c03\u6574\u7ebf\u7a0b\u7684\u6570\u91cf\u3002\u5bf9 GC \u8fdb\u884c\u9002\u5f53\u7684\u8c03\u4f18\uff0c\u53ef\u4ee5\u5927\u5927\u63d0\u9ad8\u5e94\u7528\u7684\u6027\u80fd\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>5.<\/strong><strong>\u5c0f\u7ed3<\/strong><\/h2>\n\n\n\n<p>GC \u662f JVM \u4e2d\u7684\u91cd\u8981\u673a\u5236\uff0c\u5b83\u786e\u4fdd\u4e86\u5185\u5b58\u7684\u9ad8\u6548\u5229\u7528\u3002\u7406\u89e3\u5176\u80cc\u540e\u7684\u7b97\u6cd5\u548c\u5de5\u4f5c\u539f\u7406\uff0c\u53ef\u4ee5\u5e2e\u52a9\u5f00\u53d1\u8005\u66f4\u597d\u5730\u7f16\u5199\u4ee3\u7801\u548c\u4f18\u5316\u5e94\u7528\u3002\u4e0d\u4ec5\u5982\u6b64\uff0c\u5f53\u9762\u5bf9\u590d\u6742\u7684\u5185\u5b58\u6cc4\u6f0f\u95ee\u9898\u65f6\uff0c\u6df1\u5165\u4e86\u89e3 GC \u4e5f\u662f\u627e\u5230\u95ee\u9898\u6839\u6e90\u7684\u5173\u952e\u3002<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img fetchpriority=\"high\" decoding=\"async\" width=\"484\" height=\"300\" src=\"https:\/\/cdn-docs.pingcode.com\/wp-content\/uploads\/2023\/10\/\u6dfb\u52a0\u6807\u9898-20-1.png?x-oss-process=image\/auto-orient,1\/format,webp\" alt=\"\" class=\"wp-image-58852\" \/><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\"><strong>\u5e38\u89c1\u95ee\u7b54<\/strong><\/h2>\n\n\n\n<p><strong>1.<\/strong><strong>\u4ec0\u4e48\u662fGC\u6807\u8bb0-\u6e05\u9664\u7b97\u6cd5\u4e2d\u7684\u201c\u6682\u505c\u65f6\u95f4\u201d\u6216\u201c\u505c\u987f\u65f6\u95f4\u201d\uff1f<\/strong><\/p>\n\n\n\n<p>\u6682\u505c\u65f6\u95f4\u6216\u505c\u987f\u65f6\u95f4\u662f\u5783\u573e\u56de\u6536\u8fc7\u7a0b\u4e2d\uff0c\u56e0\u4e3aGC\u6d3b\u52a8\uff0c\u9700\u8981\u6682\u505c\u5e94\u7528\u7a0b\u5e8f\u4e2d\u7684\u5176\u4ed6\u7ebf\u7a0b\u7684\u65f6\u95f4\u6bb5\u3002\u5728\u8fd9\u4e2a\u65f6\u95f4\u5185\uff0c\u6240\u6709\u7684\u5e94\u7528\u7ebf\u7a0b\u90fd\u4f1a\u88ab\u6682\u505c\uff0c\u4ee5\u786e\u4fdd\u5783\u573e\u56de\u6536\u53ef\u4ee5\u6b63\u786e\u3001\u5b89\u5168\u5730\u6267\u884c\u3002<\/p>\n\n\n\n<p><strong>2.<\/strong><strong>\u4e3a\u4ec0\u4e48\u5728\u6807\u8bb0-\u6e05\u9664\u7b97\u6cd5\u7684\u6267\u884c\u8fc7\u7a0b\u4e2d\u9700\u8981\u6682\u505c\u5176\u4ed6\u7ebf\u7a0b\uff1f<\/strong><\/p>\n\n\n\n<p>\u6682\u505c\u5176\u4ed6\u7ebf\u7a0b\u662f\u4e3a\u4e86\u786e\u4fdd\u6570\u636e\u7684\u4e00\u81f4\u6027\u548c\u5b8c\u6574\u6027\u3002\u5982\u679c\u5e94\u7528\u7ebf\u7a0b\u5728GC\u8fc7\u7a0b\u4e2d\u7ee7\u7eed\u8fd0\u884c\uff0c\u5b83\u4eec\u53ef\u80fd\u4f1a\u521b\u5efa\u65b0\u7684\u5bf9\u8c61\u3001\u4fee\u6539\u6216\u5220\u9664\u73b0\u6709\u5bf9\u8c61\u3002\u8fd9\u53ef\u80fd\u4f1a\u5e72\u6270GC\u7684\u6b63\u786e\u6267\u884c\uff0c\u5bfc\u81f4\u672a\u80fd\u6b63\u786e\u8bc6\u522b\u548c\u6e05\u7406\u5783\u573e\u6570\u636e\uff0c\u6216\u8005\u8bef\u5220\u9664\u4ecd\u5728\u4f7f\u7528\u7684\u6570\u636e\u3002<\/p>\n\n\n\n<p><strong>3.<\/strong><strong>\u662f\u5426\u6240\u6709\u7684GC\u7b97\u6cd5\u90fd\u9700\u8981\u6682\u505c\u5e94\u7528\u7ebf\u7a0b\uff1f<\/strong><\/p>\n\n\n\n<p>\u4e0d\u662f\u6240\u6709\u7684GC\u7b97\u6cd5\u90fd\u9700\u8981\u5b8c\u5168\u6682\u505c\u5e94\u7528\u7ebf\u7a0b\u3002\u6807\u8bb0-\u6e05\u9664\u7b97\u6cd5\u662f\u5176\u4e2d\u4e4b\u4e00\u9700\u8981\u6682\u505c\u7684\uff0c\u4f46\u8fd8\u6709\u5176\u4ed6\u5982\u5e76\u53d1\u6807\u8bb0-\u626b\u63cf\uff08CMS\uff09\u7b49\u7b97\u6cd5\uff0c\u5b83\u4eec\u5c1d\u8bd5\u6700\u5c0f\u5316\u6682\u505c\u65f6\u95f4\u3002\u7136\u800c\uff0c\u7edd\u5927\u591a\u6570GC\u7b97\u6cd5\u5728\u67d0\u4e9b\u9636\u6bb5\u90fd\u9700\u8981\u81f3\u5c11\u77ed\u6682\u7684\u6682\u505c\u3002<\/p>\n\n\n\n<p><strong>4.GC<\/strong><strong>\u6682\u505c\u65f6\u95f4\u957f\u662f\u5426\u4f1a\u5bf9\u5e94\u7528\u7a0b\u5e8f\u6027\u80fd\u9020\u6210\u5f71\u54cd\uff1f<\/strong><\/p>\n\n\n\n<p>\u662f\u7684\uff0c\u8fc7\u957f\u7684GC\u6682\u505c\u65f6\u95f4\u53ef\u80fd\u4f1a\u5bf9\u5e94\u7528\u7a0b\u5e8f\u6027\u80fd\u4ea7\u751f\u8d1f\u9762\u5f71\u54cd\uff0c\u7279\u522b\u662f\u5bf9\u4e8e\u5b9e\u65f6\u6216\u9ad8\u4ea4\u4e92\u6027\u7684\u5e94\u7528\u3002\u7528\u6237\u53ef\u80fd\u4f1a\u7ecf\u5386\u660e\u663e\u7684\u5ef6\u8fdf\u6216\u5e94\u7528\u7a0b\u5e8f\u7684\u5361\u987f\uff0c\u8fd9\u53ef\u80fd\u4f1a\u964d\u4f4e\u7528\u6237\u4f53\u9a8c\u3002<\/p>\n\n\n\n<p><strong>5.<\/strong><strong>\u5982\u4f55\u51cf\u5c11GC\u7684\u6682\u505c\u65f6\u95f4\u6216\u5bf9\u5e94\u7528\u7a0b\u5e8f\u7684\u5f71\u54cd\uff1f<\/strong><\/p>\n\n\n\n<p>\u53ef\u4ee5\u8003\u8651\u4f7f\u7528\u4f4e\u6682\u505c\u65f6\u95f4\u7684GC\u7b97\u6cd5\uff0c\u4f8b\u5982G1\u6216CMS\u3002\u8fd8\u53ef\u4ee5\u901a\u8fc7\u8c03\u6574\u5806\u5927\u5c0f\u3001\u4f18\u5316\u5e94\u7528\u7a0b\u5e8f\u4ee3\u7801\u3001\u51cf\u5c11\u4e0d\u5fc5\u8981\u7684\u5bf9\u8c61\u521b\u5efa\u7b49\u65b9\u5f0f\u6765\u51cf\u5c11GC\u7684\u9891\u7387\u548c\u6682\u505c\u65f6\u95f4\u3002\u76d1\u89c6\u548c\u5206\u6790GC\u65e5\u5fd7\u4e5f\u53ef\u4ee5\u5e2e\u52a9\u8bc6\u522b\u548c\u89e3\u51b3\u6027\u80fd\u95ee\u9898\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u4e86\u89e3 GC (\u5783\u573e\u6536\u96c6) \u7b97\u6cd5\u662f\u6bcf\u4f4d Java \u5f00\u53d1\u8005\u7684\u5fc5\u4fee\u8bfe\u3002\u672c\u6587\u5c06\u8be6\u7ec6\u89e3\u6790 GC \u7b97\u6cd5\u7684\u5de5\u4f5c\u539f\u7406\u3001\u5982\u4f55\u5904\u7406 [&hellip;]","protected":false},"author":5,"featured_media":58852,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/58828"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=58828"}],"version-history":[{"count":0,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/58828\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/58852"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=58828"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=58828"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=58828"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}