{"id":84788,"date":"2026-07-26T17:56:49","date_gmt":"2026-07-26T09:56:49","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/84788.html"},"modified":"2026-07-26T17:56:49","modified_gmt":"2026-07-26T09:56:49","slug":"java%e8%99%9a%e6%8b%9f%e6%9c%ba%ef%bc%9a%e4%b8%b2%e8%a1%8c%e5%9b%9e%e6%94%b6%e5%99%a8","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/84788.html","title":{"rendered":"Java\u865a\u62df\u673a\uff1a\u4e32\u884c\u56de\u6536\u5668"},"content":{"rendered":"<p>\u5728 JVM \u7684\u5783\u573e\u56de\u6536\u5668\u5bb6\u65cf\u4e2d&#xff0c;\u4e32\u884c\u56de\u6536\u5668&#xff08;Serial GC&#xff09;\u00a0\u662f\u6700\u53e4\u8001\u3001\u6700\u57fa\u7840\u7684\u4e00\u4f4d\u6210\u5458\u3002\u867d\u7136\u5b83\u4e0d\u50cf G1\u3001ZGC \u90a3\u6837\u201c\u9ad8\u5927\u4e0a\u201d&#xff0c;\u4f46\u6b63\u662f\u5b83\u5960\u5b9a\u4e86\u73b0\u4ee3\u5783\u573e\u56de\u6536\u7684\u57fa\u77f3\u3002\u7406\u89e3 Serial GC&#xff0c;\u4e0d\u4ec5\u6709\u52a9\u4e8e\u6211\u4eec\u5e94\u5bf9\u8001\u7cfb\u7edf\u7684\u6027\u80fd\u95ee\u9898&#xff0c;\u66f4\u80fd\u5e2e\u52a9\u6211\u4eec\u6df1\u523b\u7406\u89e3 GC \u7684\u8bbe\u8ba1\u601d\u60f3\u3002<\/p>\n<p>\u672c\u6587\u5c06\u5e26\u4f60\u4ece\u5de5\u4f5c\u539f\u7406\u3001\u56de\u6536\u7b97\u6cd5\u3001\u65e5\u5fd7\u89e3\u8bfb\u3001\u53c2\u6570\u914d\u7f6e\u5230\u5e94\u7528\u573a\u666f&#xff0c;\u5168\u65b9\u4f4d\u5256\u6790 Serial GC\u3002<\/p>\n<hr \/>\n<h3>\u4e00\u3001\u4ec0\u4e48\u662f\u4e32\u884c\u56de\u6536\u5668&#xff1f;<\/h3>\n<p>\u4e32\u884c\u56de\u6536\u5668\u662f JDK \u4e2d\u6700\u57fa\u672c\u7684\u5783\u573e\u56de\u6536\u5668\u4e4b\u4e00&#xff0c;\u5b83\u7684\u6838\u5fc3\u7279\u70b9\u53ef\u4ee5\u7528\u4e24\u4e2a\u8bcd\u6982\u62ec&#xff1a;\u5355\u7ebf\u7a0b\u00a0\u548c\u00a0\u72ec\u5360\u5f0f\u3002<\/p>\n<h4>1.1 \u5355\u7ebf\u7a0b\u56de\u6536<\/h4>\n<p>\u4e32\u884c\u56de\u6536\u5668\u5728\u8fdb\u884c\u5783\u573e\u56de\u6536\u65f6&#xff0c;\u4ec5\u4f7f\u7528\u4e00\u4e2a\u7ebf\u7a0b\u6765\u5b8c\u6210\u6240\u6709 GC \u5de5\u4f5c\u3002\u8fd9\u610f\u5473\u7740&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u6ca1\u6709\u591a\u7ebf\u7a0b\u534f\u4f5c\u7684\u590d\u6742\u903b\u8f91<\/p>\n<\/li>\n<li>\n<p>\u6ca1\u6709\u7ebf\u7a0b\u5207\u6362\u7684\u5f00\u9500<\/p>\n<\/li>\n<li>\n<p>\u5b9e\u73b0\u7b80\u5355&#xff0c;\u6267\u884c\u9ad8\u6548<\/p>\n<\/li>\n<\/ul>\n<h4 style=\"background-color:transparent\">1.2 \u72ec\u5360\u5f0f\u56de\u6536&#xff08;Stop-The-World&#xff09;<\/h4>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/07\/20260726095648-6a65d9e08d3c8.png\" \/><\/p>\n<p>\u4e32\u884c\u56de\u6536\u5668\u662f\u72ec\u5360\u5f0f\u7684\u2014\u2014\u5f53\u5b83\u5f00\u59cb\u5de5\u4f5c\u65f6&#xff0c;Java \u5e94\u7528\u7a0b\u5e8f\u4e2d\u7684\u6240\u6709\u7528\u6237\u7ebf\u7a0b\u90fd\u5fc5\u987b\u5b8c\u5168\u6682\u505c&#xff0c;\u7b49\u5f85 GC \u5b8c\u6210\u3002\u8fd9\u4e2a\u8fc7\u7a0b\u88ab\u79f0\u4e3a\u00a0&#034;Stop-The-World&#034;&#xff08;\u7b80\u79f0 STW&#xff09;\u3002<\/p>\n<p>\u5728 GC \u671f\u95f4&#xff0c;\u6240\u6709\u4e1a\u52a1\u7ebf\u7a0b\u90fd\u88ab\u201c\u51bb\u7ed3\u201d&#xff0c;\u8fd9\u5bf9\u5b9e\u65f6\u6027\u8981\u6c42\u8f83\u9ad8\u7684\u7cfb\u7edf\u6765\u8bf4&#xff0c;\u53ef\u80fd\u662f\u4e0d\u53ef\u63a5\u53d7\u7684\u3002\u4f46\u5728\u67d0\u4e9b\u573a\u666f\u4e0b&#xff0c;\u8fd9\u79cd\u201c\u7b80\u5355\u7c97\u66b4\u201d\u7684\u65b9\u5f0f\u53cd\u800c\u5e26\u6765\u4e86\u6700\u4f73\u6027\u80fd\u3002<\/p>\n<hr \/>\n<h3>\u4e8c\u3001\u65b0\u751f\u4ee3\u4e32\u884c\u56de\u6536\u5668&#xff08;Serial Young GC&#xff09;<\/h3>\n<h4>2.1 \u7b97\u6cd5&#xff1a;\u590d\u5236\u7b97\u6cd5<\/h4>\n<p>\u65b0\u751f\u4ee3\u4e32\u884c\u56de\u6536\u5668\u91c7\u7528\u00a0\u590d\u5236\u7b97\u6cd5&#xff08;Copying Algorithm&#xff09;\u3002<\/p>\n<p>\u5176\u6838\u5fc3\u601d\u60f3\u662f&#xff1a;\u5c06\u65b0\u751f\u4ee3\u5185\u5b58\u5212\u5206\u4e3a\u4e00\u4e2a\u8f83\u5927\u7684\u00a0Eden \u533a\u00a0\u548c\u4e24\u4e2a\u8f83\u5c0f\u7684\u00a0Survivor \u533a&#xff08;From \u548c To&#xff09;\u3002\u6bcf\u6b21 GC \u65f6&#xff0c;\u5c06 Eden \u548c From \u4e2d\u5b58\u6d3b\u7684\u5bf9\u8c61\u590d\u5236\u5230 To \u533a&#xff0c;\u7136\u540e\u6e05\u7a7a Eden \u548c From&#xff0c;\u6700\u540e\u4ea4\u6362 From \u548c To \u7684\u89d2\u8272\u3002<\/p>\n<p>\u4e3a\u4ec0\u4e48\u7528\u590d\u5236\u7b97\u6cd5&#xff1f;<\/p>\n<ul>\n<li>\n<p>\u65b0\u751f\u4ee3\u5bf9\u8c61\u671d\u751f\u5915\u6b7b&#xff0c;\u5b58\u6d3b\u7387\u6781\u4f4e<\/p>\n<\/li>\n<li>\n<p>\u590d\u5236\u7b97\u6cd5\u7684\u6548\u7387\u4e0e\u5b58\u6d3b\u5bf9\u8c61\u6570\u91cf\u6210\u6b63\u6bd4&#xff0c;\u975e\u5e38\u9002\u5408\u65b0\u751f\u4ee3<\/p>\n<\/li>\n<li>\n<p>\u5b9e\u73b0\u7b80\u5355&#xff0c;\u6ca1\u6709\u5185\u5b58\u788e\u7247\u95ee\u9898<\/p>\n<\/li>\n<\/ul>\n<h4 style=\"background-color:transparent\">2.2 \u4f18\u52bf\u4e0e\u5c40\u9650<\/h4>\n<table>\n<tr>\u4f18\u52bf\u5c40\u9650<\/tr>\n<tbody>\n<tr>\n<td>\u5b9e\u73b0\u7b80\u5355&#xff0c;\u903b\u8f91\u9ad8\u6548<\/td>\n<td>\u5355\u7ebf\u7a0b\u65e0\u6cd5\u5229\u7528\u591a\u6838 CPU<\/td>\n<\/tr>\n<tr>\n<td>\u65e0\u7ebf\u7a0b\u5207\u6362\u5f00\u9500<\/td>\n<td>GC \u671f\u95f4\u5fc5\u987b STW<\/td>\n<\/tr>\n<tr>\n<td>\u5728\u5355 CPU \u73af\u5883\u4e0b\u6027\u80fd\u4f18\u5f02<\/td>\n<td>\u5806\u5185\u5b58\u8f83\u5927\u65f6\u505c\u987f\u65f6\u95f4\u8fc7\u957f<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>2.3 \u53c2\u6570\u914d\u7f6e<\/h4>\n<p>-XX:&#043;UseSerialGC<\/p>\n<p>\u4f7f\u7528\u8be5\u53c2\u6570\u540e&#xff0c;JVM \u4f1a\u540c\u65f6\u542f\u7528&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u65b0\u751f\u4ee3&#xff1a;Serial \u6536\u96c6\u5668&#xff08;\u4f7f\u7528\u590d\u5236\u7b97\u6cd5&#xff09;<\/p>\n<\/li>\n<li>\n<p>\u8001\u5e74\u4ee3&#xff1a;Serial Old \u6536\u96c6\u5668&#xff08;\u4f7f\u7528\u6807\u8bb0-\u538b\u7f29\u7b97\u6cd5&#xff09;<\/p>\n<\/li>\n<\/ul>\n<p>\u5728\u00a0Client \u6a21\u5f0f\u00a0\u4e0b&#xff0c;Serial GC \u662f JVM \u7684\u9ed8\u8ba4\u5783\u573e\u6536\u96c6\u5668\u3002<\/p>\n<hr \/>\n<h3>\u4e09\u3001\u8001\u5e74\u4ee3\u4e32\u884c\u56de\u6536\u5668&#xff08;Serial Old GC&#xff09;<\/h3>\n<h4>3.1 \u7b97\u6cd5&#xff1a;\u6807\u8bb0-\u538b\u7f29\u7b97\u6cd5<\/h4>\n<p>\u8001\u5e74\u4ee3\u4e32\u884c\u56de\u6536\u5668\u91c7\u7528\u00a0\u6807\u8bb0-\u538b\u7f29\u7b97\u6cd5&#xff08;Mark-Compact Algorithm&#xff09;\u3002<\/p>\n<p>\u8be5\u7b97\u6cd5\u5206\u4e3a\u4e09\u4e2a\u9636\u6bb5&#xff1a;<\/p>\n<li>\n<p>\u6807\u8bb0&#xff08;Mark&#xff09;&#xff1a;\u4ece GC Roots \u51fa\u53d1&#xff0c;\u6807\u8bb0\u6240\u6709\u5b58\u6d3b\u5bf9\u8c61<\/p>\n<\/li>\n<li>\n<p>\u538b\u7f29&#xff08;Compact&#xff09;&#xff1a;\u5c06\u6240\u6709\u5b58\u6d3b\u5bf9\u8c61\u5411\u4e00\u7aef\u79fb\u52a8&#xff0c;\u4f7f\u5b83\u4eec\u8fde\u7eed\u6392\u5217<\/p>\n<\/li>\n<li>\n<p>\u6e05\u7406&#xff08;Sweep&#xff09;&#xff1a;\u6e05\u7406\u6389\u8fb9\u754c\u4ee5\u5916\u7684\u5185\u5b58\u7a7a\u95f4<\/p>\n<\/li>\n<p>\u4e3a\u4ec0\u4e48\u8001\u5e74\u4ee3\u4e0d\u7528\u590d\u5236\u7b97\u6cd5&#xff1f;<\/p>\n<ul>\n<li>\n<p>\u8001\u5e74\u4ee3\u5bf9\u8c61\u5b58\u6d3b\u7387\u9ad8&#xff0c;\u590d\u5236\u6210\u672c\u592a\u9ad8<\/p>\n<\/li>\n<li>\n<p>\u6807\u8bb0-\u538b\u7f29\u7b97\u6cd5\u907f\u514d\u4e86\u5185\u5b58\u788e\u7247&#xff0c;\u4e14\u4e0d\u9700\u8981\u989d\u5916\u7a7a\u95f4<\/p>\n<\/li>\n<\/ul>\n<h4>3.2 \u6ce8\u610f&#xff1a;\u8001\u5e74\u4ee3 GC \u505c\u987f\u66f4\u957f<\/h4>\n<p>\u7531\u4e8e\u8001\u5e74\u4ee3\u7a7a\u95f4\u901a\u5e38\u66f4\u5927&#xff0c;\u4e14\u5b58\u6d3b\u5bf9\u8c61\u66f4\u591a&#xff0c;Full GC \u7684\u505c\u987f\u65f6\u95f4\u5f80\u5f80\u8fdc\u8d85 Young GC\u3002\u5728\u5806\u5185\u5b58\u8f83\u5927\u7684\u5e94\u7528\u4e2d&#xff0c;\u4e00\u6b21 Serial Old GC \u53ef\u80fd\u5bfc\u81f4\u79d2\u7ea7\u751a\u81f3\u66f4\u957f\u7684\u505c\u987f&#xff0c;\u8fd9\u5728\u751f\u4ea7\u73af\u5883\u4e2d\u9700\u8981\u7279\u522b\u8b66\u60d5\u3002<\/p>\n<h4>3.3 \u53c2\u6570\u914d\u7f6e<\/h4>\n<p># \u65b9\u5f0f\u4e00&#xff1a;\u65b0\u751f\u4ee3\u548c\u8001\u5e74\u4ee3\u90fd\u4f7f\u7528\u4e32\u884c<br \/>\n-XX:&#043;UseSerialGC<\/p>\n<p># \u65b9\u5f0f\u4e8c&#xff1a;\u65b0\u751f\u4ee3\u4f7f\u7528 ParNew&#xff0c;\u8001\u5e74\u4ee3\u4f7f\u7528\u4e32\u884c<br \/>\n-XX:&#043;UseParNewGC<\/p>\n<p># \u65b9\u5f0f\u4e09&#xff1a;\u65b0\u751f\u4ee3\u4f7f\u7528 ParallelGC&#xff0c;\u8001\u5e74\u4ee3\u4f7f\u7528\u4e32\u884c<br \/>\n-XX:&#043;UseParallelGC<\/p>\n<hr \/>\n<h3>\u56db\u3001GC \u65e5\u5fd7\u6df1\u5ea6\u89e3\u8bfb<\/h3>\n<h4>4.1 \u65b0\u751f\u4ee3 GC \u65e5\u5fd7<\/h4>\n<p>[GC [DefNew: 310K-&gt;194K(2368K), 0.0269163 secs] 310K-&gt;194K(7680K), 0.0269513 secs] [Times: user&#061;0.00 sys&#061;0.00, real&#061;0.03 secs]<\/p>\n<p>\u6211\u4eec\u6765\u9010\u6bb5\u62c6\u89e3&#xff1a;<\/p>\n<table>\n<tr>\u65e5\u5fd7\u7247\u6bb5\u542b\u4e49<\/tr>\n<tbody>\n<tr>\n<td>GC<\/td>\n<td>\u8868\u793a\u8fd9\u662f\u4e00\u6b21 Young GC&#xff08;\u800c\u975e Full GC&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>[DefNew<\/td>\n<td>\u8868\u793a GC \u53d1\u751f\u5728\u65b0\u751f\u4ee3&#xff08;Default New Generation&#xff09;&#xff0c;\u8fd9\u662f Serial GC \u7279\u6709\u7684\u540d\u79f0<\/td>\n<\/tr>\n<tr>\n<td>310K-&gt;194K(2368K)<\/td>\n<td>\u65b0\u751f\u4ee3&#xff1a;GC\u524d\u5df2\u4f7f\u7528\u2192GC\u540e\u5df2\u4f7f\u7528&#xff08;\u8be5\u533a\u57df\u603b\u5bb9\u91cf&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>310K-&gt;194K(7680K)<\/td>\n<td>\u6574\u4e2a\u5806&#xff1a;GC\u524d\u5df2\u4f7f\u7528\u2192GC\u540e\u5df2\u4f7f\u7528&#xff08;\u5806\u603b\u5bb9\u91cf&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>0.0269163 secs<\/td>\n<td>\u8be5\u533a\u57df GC \u8017\u65f6<\/td>\n<\/tr>\n<tr>\n<td>[Times: user&#061;0.00 sys&#061;0.00 real&#061;0.03 secs]<\/td>\n<td>\u89c1\u4e0b\u65b9\u8be6\u89e3<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Times \u5b57\u6bb5\u8be6\u89e3&#xff1a;<\/p>\n<ul>\n<li>\n<p>user&#xff1a;GC \u7ebf\u7a0b\u6d88\u8017\u7684 CPU \u65f6\u95f4<\/p>\n<\/li>\n<li>\n<p>sys&#xff1a;\u64cd\u4f5c\u7cfb\u7edf\u8c03\u7528\u53ca\u7b49\u5f85\u7cfb\u7edf\u4e8b\u4ef6\u7684\u65f6\u95f4<\/p>\n<\/li>\n<li>\n<p>real&#xff1a;\u5e94\u7528\u7a0b\u5e8f\u5b9e\u9645\u6682\u505c\u7684\u65f6\u95f4&#xff08;\u6302\u949f\u65f6\u95f4&#xff09;<\/p>\n<\/li>\n<\/ul>\n<p>\u5bf9\u4e8e Serial GC&#xff0c;\u7531\u4e8e\u53ea\u4f7f\u7528\u5355\u7ebf\u7a0b&#xff0c;real \u2248 user &#043; sys\u3002<\/p>\n<h4>4.2 \u8001\u5e74\u4ee3 GC&#xff08;Full GC&#xff09;\u65e5\u5fd7<\/h4>\n<p>25.299: [Full GC (Allocation Failure) 25.300: [Tenured: 126975K-&gt;84388K(126976K), 0.1865275 secs] 741375K-&gt;84388K(741376K), [Metaspace: 3476K-&gt;3476K(1056768K)], 0.1866490 secs] [Times: user&#061;0.19 sys&#061;0.00, real&#061;0.18 secs]<\/p>\n<table>\n<tr>\u65e5\u5fd7\u7247\u6bb5\u542b\u4e49<\/tr>\n<tbody>\n<tr>\n<td>Full GC<\/td>\n<td>\u8868\u793a\u8fd9\u662f\u4e00\u6b21 Full GC<\/td>\n<\/tr>\n<tr>\n<td>(Allocation Failure)<\/td>\n<td>GC \u89e6\u53d1\u539f\u56e0&#xff1a;\u5206\u914d\u5bf9\u8c61\u5931\u8d25&#xff08;\u5185\u5b58\u4e0d\u8db3&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>[Tenured<\/td>\n<td>\u8001\u5e74\u4ee3&#xff08;Tenured Generation&#xff09;\u7684 GC \u4fe1\u606f<\/td>\n<\/tr>\n<tr>\n<td>126975K-&gt;84388K(126976K)<\/td>\n<td>\u8001\u5e74\u4ee3&#xff1a;GC\u524d\u2192GC\u540e&#xff08;\u603b\u5bb9\u91cf&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>741375K-&gt;84388K(741376K)<\/td>\n<td>\u6574\u4e2a\u5806&#xff1a;GC\u524d\u2192GC\u540e&#xff08;\u603b\u5bb9\u91cf&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>Metaspace: 3476K-&gt;3476K(1056768K)<\/td>\n<td>\u5143\u7a7a\u95f4\u4fe1\u606f&#xff08;JDK 8&#043;&#xff09;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>4.3 \u4e0d\u540c\u6536\u96c6\u5668\u7684\u65b0\u751f\u4ee3\u540d\u79f0\u5bf9\u7167<\/h4>\n<table>\n<tr>\u6536\u96c6\u5668\u65b0\u751f\u4ee3\u65e5\u5fd7\u540d\u79f0\u542b\u4e49<\/tr>\n<tbody>\n<tr>\n<td>Serial<\/td>\n<td>[DefNew<\/td>\n<td>Default New Generation<\/td>\n<\/tr>\n<tr>\n<td>ParNew<\/td>\n<td>[ParNew<\/td>\n<td>Parallel New Generation<\/td>\n<\/tr>\n<tr>\n<td>Parallel Scavenge<\/td>\n<td>[PSYoungGen<\/td>\n<td>Parallel Scavenge Young Generation<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h3>\u4e94\u3001\u793a\u4f8b\u4ee3\u7801\u4e0e\u8fd0\u884c\u9a8c\u8bc1<\/h3>\n<p>\u4e0b\u9762\u6211\u4eec\u7528\u4e00\u6bb5\u4ee3\u7801\u6765\u6a21\u62df\u5185\u5b58\u6ea2\u51fa&#xff0c;\u89c2\u5bdf Serial GC \u7684\u5de5\u4f5c\u8fc7\u7a0b&#xff1a;<\/p>\n<p>import java.util.Random;<\/p>\n<p>public class GCDemo {<br \/>\n    public static void main(String[] args) {<br \/>\n        System.out.println(&#034;&#061;&#061;&#061;&#061;&#061; GCDemo, Hello &#061;&#061;&#061;&#061;&#061;&#034;);<br \/>\n        try {<br \/>\n            String str &#061; &#034;GCDemo&#034;;<br \/>\n            while (true) {<br \/>\n                str &#043;&#061; str &#043; new Random().nextInt(77777777)<br \/>\n                           &#043; new Random().nextInt(88888888);<br \/>\n                str.intern();<br \/>\n            }<br \/>\n        } catch (Throwable e) {<br \/>\n            e.printStackTrace();<br \/>\n        }<br \/>\n    }<br \/>\n}<\/p>\n<p>\u8fd0\u884c\u53c2\u6570&#xff1a;<\/p>\n<p>-XX:&#043;UseSerialGC -Xms10m -Xmx10m -XX:&#043;PrintGCDetails<\/p>\n<p>\u8f93\u51fa\u65e5\u5fd7\u793a\u4f8b&#xff1a;<\/p>\n<p>[GC [DefNew: 1393K-&gt;25K(3072K), 0.009758 secs] 5793K-&gt;5793K(9920K), 0.0010059 secs]<br \/>\n[Full GC (Allocation Failure) [Tenured: 5767K-&gt;4167K(6948K), 0.0023995 secs] &#8230;<br \/>\njava.lang.OutOfMemoryError: Java heap space<br \/>\n    at java.util.Arrays.copyOf(Arrays.java:3332)<br \/>\n    at java.lang.AbstractStringBuilder.ensureCapacityInternal(&#8230;)<\/p>\n<p>\u53ef\u4ee5\u770b\u5230&#xff1a;<\/p>\n<li>\n<p>DefNew\u00a0\u786e\u8ba4\u4e86 Serial GC \u5728\u65b0\u751f\u4ee3\u5de5\u4f5c<\/p>\n<\/li>\n<li>\n<p>Tenured\u00a0\u786e\u8ba4\u4e86 Serial Old \u5728\u8001\u5e74\u4ee3\u5de5\u4f5c<\/p>\n<\/li>\n<li>\n<p>\u9891\u7e41\u7684 GC \u6700\u7ec8\u5bfc\u81f4\u00a0OutOfMemoryError<\/p>\n<\/li>\n<hr \/>\n<h3>\u516d\u3001\u603b\u7ed3&#xff1a;Serial GC \u7684\u4f18\u7f3a\u70b9\u4e0e\u5e94\u7528\u573a\u666f<\/h3>\n<h4>6.1 \u4f18\u70b9<\/h4>\n<p>\u2705\u00a0\u5b9e\u73b0\u7b80\u5355&#xff0c;\u903b\u8f91\u9ad8\u6548\u00a0\u2014 \u4ee3\u7801\u6210\u719f\u7a33\u5b9a&#xff0c;\u51e0\u4e4e\u6ca1\u6709\u590d\u6742 bug<br \/>\n\u2705\u00a0\u5355\u7ebf\u7a0b\u65e0\u4ea4\u4e92\u5f00\u9500\u00a0\u2014 \u6ca1\u6709\u591a\u7ebf\u7a0b\u9501\u7ade\u4e89\u548c\u4e0a\u4e0b\u6587\u5207\u6362<br \/>\n\u2705\u00a0\u5728\u5355 CPU \u73af\u5883\u4e0b\u6027\u80fd\u6700\u4f73\u00a0\u2014 \u591a\u7ebf\u7a0b\u53cd\u800c\u4f1a\u5e26\u6765\u989d\u5916\u5f00\u9500<br \/>\n\u2705\u00a0\u5185\u5b58\u5360\u7528\u5c0f\u00a0\u2014 \u4e0d\u9700\u8981\u7ef4\u62a4\u590d\u6742\u7684\u6570\u636e\u7ed3\u6784<\/p>\n<h4>6.2 \u7f3a\u70b9<\/h4>\n<p>\u274c\u00a0STW \u505c\u987f\u65f6\u95f4\u957f\u00a0\u2014 \u5806\u5185\u5b58\u8d8a\u5927&#xff0c;\u505c\u987f\u8d8a\u660e\u663e<br \/>\n\u274c\u00a0\u65e0\u6cd5\u5229\u7528\u591a\u6838 CPU\u00a0\u2014 \u5728\u591a\u6838\u65f6\u4ee3\u663e\u5f97\u6709\u4e9b\u201c\u843d\u4f0d\u201d<br \/>\n\u274c\u00a0\u7528\u6237\u4f53\u9a8c\u5dee\u00a0\u2014 \u5728\u4ea4\u4e92\u5f0f\u5e94\u7528\u4e2d&#xff0c;\u505c\u987f\u53ef\u80fd\u5bfc\u81f4\u5361\u987f<\/p>\n<h4>6.3 \u9002\u7528\u573a\u666f<\/h4>\n<table>\n<tr>\u573a\u666f\u662f\u5426\u9002\u7528\u539f\u56e0<\/tr>\n<tbody>\n<tr>\n<td>Client \u6a21\u5f0f\u4e0b\u7684 JVM<\/td>\n<td>\u2705 \u9ed8\u8ba4\u9009\u62e9<\/td>\n<td>\u8d44\u6e90\u53d7\u9650\u73af\u5883&#xff0c;\u7b80\u5355\u9ad8\u6548<\/td>\n<\/tr>\n<tr>\n<td>\u5355 CPU \u670d\u52a1\u5668<\/td>\n<td>\u2705 \u6700\u4f73\u9009\u62e9<\/td>\n<td>\u591a\u7ebf\u7a0b\u65e0\u6cd5\u5e26\u6765\u6536\u76ca<\/td>\n<\/tr>\n<tr>\n<td>\u5806\u5185\u5b58 &lt; 100MB<\/td>\n<td>\u2705 \u53ef\u63a5\u53d7<\/td>\n<td>\u505c\u987f\u65f6\u95f4\u53ef\u63a7<\/td>\n<\/tr>\n<tr>\n<td>\u5b9e\u65f6 Web \u5e94\u7528<\/td>\n<td>\u274c \u4e0d\u63a8\u8350<\/td>\n<td>\u505c\u987f\u5f71\u54cd\u7528\u6237\u4f53\u9a8c<\/td>\n<\/tr>\n<tr>\n<td>\u5927\u5806\u5185\u5b58&#xff08;&gt;4GB&#xff09;<\/td>\n<td>\u274c \u4e0d\u63a8\u8350<\/td>\n<td>\u505c\u987f\u65f6\u95f4\u8fc7\u957f<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h3><\/h3>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 JVM \u7684\u5783\u573e\u56de\u6536\u5668\u5bb6\u65cf\u4e2d&#xff0c;\u4e32\u884c\u56de\u6536\u5668&#xff08;Serial GC&#xff09;\u00a0\u662f\u6700\u53e4\u8001\u3001\u6700\u57fa\u7840\u7684\u4e00\u4f4d\u6210\u5458\u3002\u867d\u7136\u5b83\u4e0d\u50cf G1\u3001ZGC \u90a3\u6837\u201c\u9ad8\u5927\u4e0a\u201d&#xff0c;\u4f46\u6b63\u662f\u5b83\u5960\u5b9a\u4e86\u73b0\u4ee3\u5783\u573e\u56de\u6536\u7684\u57fa\u77f3\u3002\u7406\u89e3 Serial GC&#xff0c;\u4e0d\u4ec5\u6709\u52a9\u4e8e\u6211\u4eec\u5e94\u5bf9\u8001\u7cfb\u7edf\u7684\u6027\u80fd\u95ee\u9898&#xff0c;\u66f4\u80fd\u5e2e\u52a9\u6211\u4eec\u6df1\u523b\u7406\u89e3 GC \u7684\u8bbe\u8ba1\u601d\u60f3\u3002\u672c\u6587\u5c06\u5e26\u4f60\u4ece\u5de5\u4f5c\u539f\u7406\u3001\u56de\u6536\u7b97\u6cd5\u3001\u65e5\u5fd7\u89e3\u8bfb\u3001\u53c2\u6570\u914d\u7f6e\u5230\u5e94\u7528\u573a\u666f&#xff0c;\u5168\u65b9\u4f4d\u5256\u6790 Serial GC\u3002\u4e00\u3001\u4ec0\u4e48\u662f\u4e32\u884c\u56de<\/p>\n","protected":false},"author":2,"featured_media":84787,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[99,426,190],"topic":[],"class_list":["post-84788","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-java","tag-jvm","tag-190"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Java\u865a\u62df\u673a\uff1a\u4e32\u884c\u56de\u6536\u5668 - \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\/84788.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Java\u865a\u62df\u673a\uff1a\u4e32\u884c\u56de\u6536\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u5728 JVM \u7684\u5783\u573e\u56de\u6536\u5668\u5bb6\u65cf\u4e2d&#xff0c;\u4e32\u884c\u56de\u6536\u5668&#xff08;Serial GC&#xff09;\u00a0\u662f\u6700\u53e4\u8001\u3001\u6700\u57fa\u7840\u7684\u4e00\u4f4d\u6210\u5458\u3002\u867d\u7136\u5b83\u4e0d\u50cf G1\u3001ZGC \u90a3\u6837\u201c\u9ad8\u5927\u4e0a\u201d&#xff0c;\u4f46\u6b63\u662f\u5b83\u5960\u5b9a\u4e86\u73b0\u4ee3\u5783\u573e\u56de\u6536\u7684\u57fa\u77f3\u3002\u7406\u89e3 Serial GC&#xff0c;\u4e0d\u4ec5\u6709\u52a9\u4e8e\u6211\u4eec\u5e94\u5bf9\u8001\u7cfb\u7edf\u7684\u6027\u80fd\u95ee\u9898&#xff0c;\u66f4\u80fd\u5e2e\u52a9\u6211\u4eec\u6df1\u523b\u7406\u89e3 GC \u7684\u8bbe\u8ba1\u601d\u60f3\u3002\u672c\u6587\u5c06\u5e26\u4f60\u4ece\u5de5\u4f5c\u539f\u7406\u3001\u56de\u6536\u7b97\u6cd5\u3001\u65e5\u5fd7\u89e3\u8bfb\u3001\u53c2\u6570\u914d\u7f6e\u5230\u5e94\u7528\u573a\u666f&#xff0c;\u5168\u65b9\u4f4d\u5256\u6790 Serial GC\u3002\u4e00\u3001\u4ec0\u4e48\u662f\u4e32\u884c\u56de\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/84788.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-26T09:56:49+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/07\/20260726095648-6a65d9e08d3c8.png\" \/>\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=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/84788.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/84788.html\",\"name\":\"Java\u865a\u62df\u673a\uff1a\u4e32\u884c\u56de\u6536\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-07-26T09:56:49+00:00\",\"dateModified\":\"2026-07-26T09:56:49+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/84788.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/84788.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/84788.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\u865a\u62df\u673a\uff1a\u4e32\u884c\u56de\u6536\u5668\"}]},{\"@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":"Java\u865a\u62df\u673a\uff1a\u4e32\u884c\u56de\u6536\u5668 - \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\/84788.html","og_locale":"zh_CN","og_type":"article","og_title":"Java\u865a\u62df\u673a\uff1a\u4e32\u884c\u56de\u6536\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u5728 JVM \u7684\u5783\u573e\u56de\u6536\u5668\u5bb6\u65cf\u4e2d&#xff0c;\u4e32\u884c\u56de\u6536\u5668&#xff08;Serial GC&#xff09;\u00a0\u662f\u6700\u53e4\u8001\u3001\u6700\u57fa\u7840\u7684\u4e00\u4f4d\u6210\u5458\u3002\u867d\u7136\u5b83\u4e0d\u50cf G1\u3001ZGC \u90a3\u6837\u201c\u9ad8\u5927\u4e0a\u201d&#xff0c;\u4f46\u6b63\u662f\u5b83\u5960\u5b9a\u4e86\u73b0\u4ee3\u5783\u573e\u56de\u6536\u7684\u57fa\u77f3\u3002\u7406\u89e3 Serial GC&#xff0c;\u4e0d\u4ec5\u6709\u52a9\u4e8e\u6211\u4eec\u5e94\u5bf9\u8001\u7cfb\u7edf\u7684\u6027\u80fd\u95ee\u9898&#xff0c;\u66f4\u80fd\u5e2e\u52a9\u6211\u4eec\u6df1\u523b\u7406\u89e3 GC \u7684\u8bbe\u8ba1\u601d\u60f3\u3002\u672c\u6587\u5c06\u5e26\u4f60\u4ece\u5de5\u4f5c\u539f\u7406\u3001\u56de\u6536\u7b97\u6cd5\u3001\u65e5\u5fd7\u89e3\u8bfb\u3001\u53c2\u6570\u914d\u7f6e\u5230\u5e94\u7528\u573a\u666f&#xff0c;\u5168\u65b9\u4f4d\u5256\u6790 Serial GC\u3002\u4e00\u3001\u4ec0\u4e48\u662f\u4e32\u884c\u56de","og_url":"https:\/\/www.wsisp.com\/helps\/84788.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-07-26T09:56:49+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/07\/20260726095648-6a65d9e08d3c8.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/84788.html","url":"https:\/\/www.wsisp.com\/helps\/84788.html","name":"Java\u865a\u62df\u673a\uff1a\u4e32\u884c\u56de\u6536\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-07-26T09:56:49+00:00","dateModified":"2026-07-26T09:56:49+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/84788.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/84788.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/84788.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Java\u865a\u62df\u673a\uff1a\u4e32\u884c\u56de\u6536\u5668"}]},{"@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\/84788","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=84788"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/84788\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/84787"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=84788"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=84788"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=84788"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=84788"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}