{"id":677,"date":"2018-07-31T13:55:48","date_gmt":"2018-07-31T04:55:48","guid":{"rendered":"https:\/\/vongg.com\/?p=677"},"modified":"2018-07-31T13:55:48","modified_gmt":"2018-07-31T04:55:48","slug":"jvm%e9%9a%be%e5%ad%a6%ef%bc%9f%e9%82%a3%e6%98%af%e5%9b%a0%e4%b8%ba%e4%bd%a0%e6%b2%a1%e8%ae%a4%e7%9c%9f%e7%9c%8b%e5%ae%8c%e8%bf%99%e7%af%87%e6%96%87%e7%ab%a0","status":"publish","type":"post","link":"https:\/\/vongg.com\/?p=677","title":{"rendered":"JVM\u96be\u5b66\uff1f\u90a3\u662f\u56e0\u4e3a\u4f60\u6ca1\u8ba4\u771f\u770b\u5b8c\u8fd9\u7bc7\u6587\u7ae0"},"content":{"rendered":"<p>http:\/\/www.cnblogs.com\/AIPAOJIAO\/p\/9387802.html<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/mmbiz.qlogo.cn\/mmbiz_png\/M37cUQ9AX6mJAkVZwoEXlzlI6HUcQJVD2uMZ0snsJDFWWQlk47qjicJ6iaic5dxGHMIbdw3PiblxfcYgnNN0DX19tw\/0?wx_fmt=png\" alt=\"\" data-type=\"png\" data-ratio=\"0.5539906103286385\" data-w=\"639\" \/><\/p>\n<p>\u6570\u636e\u533a\u57df\u5206\u7c7b\uff1a<\/p>\n<p>\u65b9\u6cd5\u533a\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 (Method Area)<\/p>\n<p>\u865a\u62df\u673a\u6808 \u00a0 \u00a0 \u00a0 \u00a0 (VM Stack)<\/p>\n<p>\u672c\u5730\u65b9\u6cd5\u6808\u00a0 \u00a0 \u00a0(Native Method Stack)<\/p>\n<p>\u5806 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 (Heap)<\/p>\n<p>\u7a0b\u5e8f\u8ba1\u6570\u5668\u00a0 \u00a0 (Program Counter Register)<\/p>\n<p>\u76f4\u63a5\u5185\u5b58 \u00a0 \u00a0 \u00a0 \u00a0(Direct Memory)<\/p>\n<p>\u8bf4\u660e\uff1a<\/p>\n<p><strong>1. \u7a0b\u5e8f\u8ba1\u6570\u5668<\/strong><\/p>\n<p>\u884c\u53f7\u6307\u793a\u5668\uff0c\u5b57\u8282\u7801\u6307\u4ee4\u7684\u5206\u652f\u3001\u5faa\u73af\u3001\u8df3\u8f6c\u3001\u5f02\u5e38\u5904\u7406\u3001\u7ebf\u7a0b\u6062\u590d(CPU\u5207\u6362)\uff0c\u6bcf\u6761\u7ebf\u7a0b\u90fd\u9700\u8981\u4e00\u4e2a\u72ec\u7acb\u7684\u8ba1\u6570\u5668\uff0c\u7ebf\u7a0b\u79c1\u6709\u5185\u5b58\u4e92\u4e0d\u5f71\u54cd,\u8be5\u533a\u57df\u4e0d\u4f1a\u53d1\u751f\u5185\u5b58\u6ea2\u51fa\u5f02\u5e38\u3002<\/p>\n<hr \/>\n<p><strong>2. \u865a\u62df\u673a\u6808<\/strong><\/p>\n<p>\u662f\u7ebf\u7a0b\u79c1\u6709\u7684\uff0c\u58f0\u660e\u5468\u671f\u4e0e\u7ebf\u7a0b\u76f8\u540c\uff0c\u865a\u62df\u673a\u6808\u662fJava\u65b9\u6cd5\u6267\u884c\u7684\u5185\u5b58\u6a21\u578b\uff0c\u6bcf\u4e2a\u65b9\u6cd5\u88ab\u6267\u884c\u65f6\u90fd\u4f1a\u521b\u5efa\u4e00\u4e2a\u6808\u5e27\uff0c\u5373\u65b9\u6cd5\u8fd0\u884c\u671f\u95f4\u7684\u57fa\u7840\u6570\u636e\u7ed3\u6784\uff0c\u6808\u5e27\u7528\u4e8e\u5b58\u50a8\uff1a\u5c40\u90e8\u53d8\u91cf\u8868\u3001\u64cd\u4f5c\u6570\u6808\u3001\u52a8\u6001\u94fe\u63a5\u3001\u65b9\u6cd5\u51fa\u53e3\u7b49\uff0c\u6bcf\u4e2a\u65b9\u6cd5\u6267\u884c\u4e2d\u90fd\u5bf9\u5e94\u865a\u62df\u673a\u6808\u5e27\u4ece\u5165\u6808\u5230\u5904\u6808\u7684\u8fc7\u7a0b\u3002<\/p>\n<p>\u662f\u4e00\u79cd\u6570\u636e\u7ed3\u6784\uff0c\u662f\u865a\u62df\u673a\u4e2d\u7684\u5c40\u90e8\u53d8\u91cf\u8868\uff0c\u5bf9\u5e94\u7269\u7406\u5c42\u4e4b\u4e0a\u7684\u7a0b\u5e8f\u6570\u636e\u6a21\u578b\u3002<\/p>\n<p>\u5c40\u90e8\u53d8\u91cf\u8868\uff0c\u662f\u4e00\u79cd\u7a0b\u5e8f\u8fd0\u884c\u6570\u636e\u6a21\u578b\uff0c\u5b58\u653e\u4e86\u7f16\u8bd1\u671f\u53ef\u77e5\u7684\u5404\u79cd\u6570\u636e\u7c7b\u578b\u4f8b\u5982\uff1a<\/p>\n<p>Boolean\u3001byte\u3001char\u3001short\u3001int\u3001float\u3001long\u3001double\u3001\u5bf9\u8c61\u5f15\u7528\u7c7b\u578b(\u5bf9\u8c61\u5185\u5b58\u5730\u5740\u53d8\u91cf\uff0c\u6307\u9488\u6216\u53e5\u67c4)\uff0c\u7a0b\u5e8f\u8fd0\u884c\u65f6\uff0c\u6839\u636e\u5c40\u90e8\u53d8\u91cf\u8868\u5206\u914d\u6808\u5e27\u7a7a\u95f4\u5927\u5c0f\uff0c\u5728\u8fd0\u884c\u4e2d\uff0c\u5927\u5c0f\u662f\u4e0d\u53d8\u7684\u5f02\u5e38\u7c7b\u578b\uff1astackOverFlowError \u7ebf\u7a0b\u8bf7\u6c42\u6808\u6df1\u5ea6\u5927\u4e8e\u865a\u62df\u673a\u5141\u8bb8\u6df1\u5ea6\u00a0OutOfMemory \u5185\u5b58\u7a7a\u95f4\u8017\u5c3d\u65e0\u6cd5\u8fdb\u884c\u6269\u5c55\u3002<\/p>\n<hr \/>\n<p><strong>3. \u672c\u5730\u65b9\u6cd5\u6808<\/strong><\/p>\n<p>\u4e0e\u865a\u62df\u673a\u6808\u7c7b\u4f3c\uff0c\u865a\u62df\u673a\u6808\u4e3aJava\u7a0b\u5e8f\u670d\u52a1\uff0c\u672c\u5730\u65b9\u6cd5\u6808\u652f\u6301\u865a\u62df\u673a\u7684\u8fd0\u884c\u670d\u52a1\uff0c\u5177\u4f53\u5b9e\u73b0\u7531\u865a\u62df\u673a\u5382\u5546\u51b3\u5b9a\uff0c\u4e5f\u4f1a\u629b\u51fa stackOverFlowError\u3001OutOfMemory\u5f02\u5e38\u3002<\/p>\n<hr \/>\n<p><strong>4. \u5806<\/strong><\/p>\n<p>\u662f\u865a\u62df\u673a\u7ba1\u7406\u5185\u5b58\u4e2d\u6700\u5927\u7684\u4e00\u90e8\u5206\uff0c\u88ab\u6240\u6709\u7ebf\u7a0b\u5171\u4eab\uff0c\u7528\u4e8e\u5b58\u653e\u5bf9\u8c61\u5b9e\u4f8b(\u5bf9\u8c61\u3001\u6570\u7ec4)\uff0c\u7269\u7406\u4e0a\u4e0d\u8fde\u7eed\u7684\u5185\u5b58\u7a7a\u95f4\uff0c\u7531\u4e8eGC\u6536\u96c6\u5668\uff0c\u5206\u4ee3\u6536\u96c6\uff0c\u6240\u4ee5\u5212\u5206\u4e3a\uff1a\u65b0\u751f\u4ee3 Eden\u3001From SurVivor\u7a7a\u95f4\u3001To SurVivor\u7a7a\u95f4\uff0callot buffer(\u5206\u914d\u7a7a\u95f4)\uff0c\u53ef\u80fd\u4f1a\u5212\u5206\u51fa\u591a\u4e2a\u7ebf\u7a0b\u79c1\u6709\u7684\u7f13\u51b2\u533a\uff0c\u8001\u5e74\u4ee3\u3002<\/p>\n<hr \/>\n<p><strong>5. \u65b9\u6cd5\u533a<\/strong><\/p>\n<p>\u4e0e\u5806\u4e00\u6837\u5c5e\u4e8e\u7ebf\u7a0b\u5171\u4eab\u7684\u5185\u5b58\u533a\u57df\uff0c\u7528\u4e8e\u5b58\u50a8\u865a\u62df\u673a\u52a0\u8f7d\u7684\u7c7b\u4fe1\u606f\u3001\u5e38\u91cf\u3001\u9759\u6001\u53d8\u91cf\u3001\u5373\u65f6\u7f16\u8bd1\u5668\u7f16\u8bd1\u540e\u7684\u4ee3\u7801\uff08\u52a8\u6001\u52a0\u8f7dOSGI\uff09\u7b49\u6570\u636e\u3002\u7406\u8bba\u4e0a\u5c5e\u4e8ejava\u865a\u62df\u673a\u7684\u4e00\u90e8\u5206\uff0c\u4e3a\u4e86\u533a\u5206\u5f00\u6765\u53eb\u505a Non-Heap\u975e\u5806\u3002<\/p>\n<p>\u8fd9\u4e2a\u533a\u57df\u53ef\u4ee5\u9009\u62e9\u4e0d\u8fdb\u884c\u5783\u573e\u56de\u6536\uff0c\u8be5\u533a\u57df\u56de\u6536\u76ee\u7684\u4e3b\u8981\u662f\u5e38\u91cf\u6c60\u7684\u56de\u6536\uff0c\u53ca\u7c7b\u578b\u7684\u5378\u8f7dclass,\u5185\u5b58\u533a\u4e0d\u8db3\u65f6\u4f1a\u629b\u51faOutOfMemory\u5f02\u5e38<\/p>\n<p><strong>\u8fd0\u884c\u65f6\u5e38\u91cf\u6c60\uff1a<\/strong><\/p>\n<p>\u65b9\u6cd5\u533a\u7684\u4e00\u90e8\u5206\uff0cClass\u7684\u7248\u672c\u3001\u5b57\u6bb5\u3001\u63a5\u53e3\u3001\u65b9\u6cd5\u7b49\uff0c\u53ca\u7f16\u8bd1\u671f\u751f\u6210\u7684\u5404\u79cd\u5b57\u9762\u91cf\u3001\u7b26\u53f7\u5f15\u7528\uff0c\u7f16\u8bd1\u7c7b\u52a0\u8f7d\u540e\u5b58\u653e\u5728\u8be5\u533a\u57df\u3002\u4f1a\u629b\u51faOutOfMemory\u5f02\u5e38\u3002<\/p>\n<hr \/>\n<p><strong>6. \u76f4\u63a5\u5185\u5b58<\/strong><\/p>\n<p>\u76f4\u63a5\u5185\u5b58\u4e0d\u5c5e\u4e8e\u865a\u62df\u5185\u5b58\u533a\u57df\uff0c\u662f\u4e00\u79cd\u57fa\u4e8e\u901a\u9053\u4e0e\u7f13\u51b2\u533a\u7684IO\u65b9\u5f0f\uff0c\u53ef\u4ee5\u4f7f\u7528\u672c\u5730\u51fd\u6570\u76f4\u63a5\u5206\u914d\u5806\u5916\u5185\u5b58\uff0c\u5728\u5806\u4e2d\u5b58\u50a8\u5f15\u7528\u7684\u5916\u90e8\u5185\u5b58\u5730\u5740\uff0c\u901a\u8fc7\u5f15\u7528\u5b8c\u6210\u5bf9\u76f4\u63a5\u5f15\u7528\u5185\u5b58\u7684\u64cd\u4f5c\uff0c1.4\u4e4b\u540e\u63d0\u4f9b\u7684NIO\u663e\u8457\u63d0\u9ad8\u6548\u7387\uff0c\u907f\u514d\u4e86\u5806\u5185\u5b58\u4e0eNative\u5185\u5b58\u7684\u6765\u56de\u590d\u5236\u64cd\u4f5c\uff0c\u4e0d\u53d7\u865a\u62df\u673a\u5185\u5b58\u63a7\u5236\uff0c\u4f1a\u629b\u51faOUtOfMemory\u5f02\u5e38\u3002<\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/mmbiz.qlogo.cn\/mmbiz_png\/M37cUQ9AX6mJAkVZwoEXlzlI6HUcQJVDmpkfxibzjibqOH3CAdEJZMY5ichricibBU3KiarFYScDibOSsqpww8YaQJ2Qg\/0?wx_fmt=png\" alt=\"\" data-type=\"png\" data-ratio=\"0.4497528830313015\" data-w=\"607\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/mmbiz.qlogo.cn\/mmbiz_png\/M37cUQ9AX6mJAkVZwoEXlzlI6HUcQJVDmib4libbH8VRnlbbYlicfJCho5src633l9Zo06icKJHh21xviaxibGvo6rNg\/0?wx_fmt=png\" alt=\"\" data-type=\"png\" data-ratio=\"0.42833876221498374\" data-w=\"614\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>http:\/\/www.cnblogs.com\/AIPAOJIAO\/p\/9387802.html \u6570\u636e\u533a\u57df\u5206\u7c7b\uff1a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[9],"tags":[111],"_links":{"self":[{"href":"https:\/\/vongg.com\/index.php?rest_route=\/wp\/v2\/posts\/677"}],"collection":[{"href":"https:\/\/vongg.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vongg.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vongg.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vongg.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=677"}],"version-history":[{"count":1,"href":"https:\/\/vongg.com\/index.php?rest_route=\/wp\/v2\/posts\/677\/revisions"}],"predecessor-version":[{"id":678,"href":"https:\/\/vongg.com\/index.php?rest_route=\/wp\/v2\/posts\/677\/revisions\/678"}],"wp:attachment":[{"href":"https:\/\/vongg.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=677"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vongg.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=677"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vongg.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=677"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}