{"id":11262,"date":"2023-11-28T21:57:34","date_gmt":"2023-11-28T13:57:34","guid":{"rendered":"https:\/\/wx.kaifamiao.info\/?p=11262"},"modified":"2023-12-08T11:25:53","modified_gmt":"2023-12-08T03:25:53","slug":"jvm-zhong-shen-me-shi-hou-hui-zao-cheng-dui-wai-ne","status":"publish","type":"post","link":"http:\/\/wx.kaifamiao.info\/index.php\/2023\/11\/28\/jvm-zhong-shen-me-shi-hou-hui-zao-cheng-dui-wai-ne\/","title":{"rendered":"JVM\u4e2d\u4ec0\u4e48\u65f6\u5019\u4f1a\u9020\u6210\u5806\u5916\u5185\u5b58\u6ea2\u51fa\uff1f"},"content":{"rendered":"<p>\u5806\u5916\u5185\u5b58\uff08Off-Heap Memory\uff09\u662f\u6307\u4e0d\u7531Java\u865a\u62df\u673a\u76f4\u63a5\u7ba1\u7406\u7684\u5185\u5b58\uff0c\u901a\u5e38\u662f\u901a\u8fc7<code>ByteBuffer<\/code>\u7b49\u65b9\u5f0f\u76f4\u63a5\u5728\u672c\u5730\u5206\u914d\u7684\u5185\u5b58\u3002\u5806\u5916\u5185\u5b58\u5e76\u4e0d\u53d7Java\u5806\u7684\u5783\u573e\u56de\u6536\u673a\u5236\u7ba1\u7406\uff0c\u56e0\u6b64\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\u53ef\u80fd\u53d1\u751f\u5806\u5916\u5185\u5b58\u6ea2\u51fa\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u53ef\u80fd\u5bfc\u81f4\u5806\u5916\u5185\u5b58\u6ea2\u51fa\u7684\u60c5\u51b5\uff1a<\/p>\n<ol>\n<li>\n<strong>\u672a\u91ca\u653e\u7684\u5806\u5916\u5185\u5b58\uff1a<\/strong><\/p>\n<ul>\n<li>\u5982\u679c\u5728\u4f7f\u7528\u5806\u5916\u5185\u5b58\u7684\u8fc7\u7a0b\u4e2d\uff0c\u6ca1\u6709\u53ca\u65f6\u91ca\u653e\u5df2\u7ecf\u5206\u914d\u7684\u5185\u5b58\uff0c\u53ef\u80fd\u4f1a\u5bfc\u81f4\u5806\u5916\u5185\u5b58\u6ea2\u51fa\u3002\u8fd9\u901a\u5e38\u662f\u7531\u4e8e\u7a0b\u5e8f\u4e2d\u5b58\u5728\u5185\u5b58\u6cc4\u6f0f\u6216\u8005\u7ba1\u7406\u4e0d\u5f53\u7684\u60c5\u51b5\u5f15\u8d77\u7684\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<strong>\u5806\u5916\u5185\u5b58\u5206\u914d\u8fc7\u591a\uff1a<\/strong><\/p>\n<ul>\n<li>\u5982\u679c\u5e94\u7528\u7a0b\u5e8f\u9891\u7e41\u5730\u5206\u914d\u5927\u91cf\u7684\u5806\u5916\u5185\u5b58\u800c\u6ca1\u6709\u53ca\u65f6\u91ca\u653e\uff0c\u53ef\u80fd\u4f1a\u5bfc\u81f4\u5806\u5916\u5185\u5b58\u8017\u5c3d\uff0c\u4ece\u800c\u53d1\u751f\u5806\u5916\u5185\u5b58\u6ea2\u51fa\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<strong>\u4f7f\u7528\u7b2c\u4e09\u65b9\u5e93\u6216\u6846\u67b6\u4e0d\u5f53\uff1a<\/strong><\/p>\n<ul>\n<li>\u4e00\u4e9b\u7b2c\u4e09\u65b9\u5e93\u6216\u6846\u67b6\u53ef\u80fd\u4f7f\u7528\u5806\u5916\u5185\u5b58\u8fdb\u884c\u6027\u80fd\u4f18\u5316\uff0c\u4f46\u5982\u679c\u5728\u4f7f\u7528\u8fd9\u4e9b\u5e93\u65f6\u6ca1\u6709\u59a5\u5584\u5904\u7406\u6216\u91ca\u653e\u5806\u5916\u5185\u5b58\uff0c\u5c31\u6709\u53ef\u80fd\u5bfc\u81f4\u6ea2\u51fa\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<strong>\u4e0d\u5f53\u4f7f\u7528\u76f4\u63a5\u5185\u5b58\uff08Direct Memory\uff09\uff1a<\/strong><\/p>\n<ul>\n<li>\u76f4\u63a5\u5185\u5b58\u901a\u5e38\u662f\u901a\u8fc7<code>ByteBuffer.allocateDirect()<\/code>\u5206\u914d\u7684\uff0c\u800c\u8fd9\u90e8\u5206\u5185\u5b58\u5b9e\u9645\u4e0a\u662f\u4ece\u5806\u5916\u76f4\u63a5\u5206\u914d\u7684\u3002\u5982\u679c\u5728\u4f7f\u7528\u76f4\u63a5\u5185\u5b58\u65f6\u6ca1\u6709\u5408\u7406\u5730\u7ba1\u7406\u548c\u91ca\u653e\uff0c\u53ef\u80fd\u4f1a\u5bfc\u81f4\u5806\u5916\u5185\u5b58\u6ea2\u51fa\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p>\u5728\u6392\u67e5\u548c\u89e3\u51b3\u5806\u5916\u5185\u5b58\u6ea2\u51fa\u95ee\u9898\u65f6\uff0c\u53ef\u4ee5\u91c7\u53d6\u4ee5\u4e0b\u4e00\u4e9b\u6b65\u9aa4\uff1a<\/p>\n<ul>\n<li>\u5b9a\u4f4d\u7a0b\u5e8f\u4e2d\u7684\u5806\u5916\u5185\u5b58\u5206\u914d\u70b9\uff0c\u68c0\u67e5\u662f\u5426\u5b58\u5728\u5185\u5b58\u6cc4\u6f0f\u6216\u8005\u5206\u914d\u4e0d\u5f53\u7684\u60c5\u51b5\u3002<\/li>\n<li>\u4f7f\u7528\u5185\u5b58\u5206\u6790\u5de5\u5177\uff0c\u5982<code>jcmd<\/code>\u6216\u8005\u7b2c\u4e09\u65b9\u5de5\u5177\uff0c\u76d1\u63a7\u5806\u5916\u5185\u5b58\u7684\u5206\u914d\u548c\u91ca\u653e\u60c5\u51b5\u3002<\/li>\n<li>\u6ce8\u610f\u68c0\u67e5\u4f7f\u7528\u7b2c\u4e09\u65b9\u5e93\u6216\u6846\u67b6\u65f6\u7684\u76f8\u5173\u6587\u6863\uff0c\u786e\u4fdd\u6b63\u786e\u5730\u4f7f\u7528\u548c\u91ca\u653e\u5806\u5916\u5185\u5b58\u3002<\/li>\n<li>\u8c03\u6574\u7a0b\u5e8f\u7684\u8bbe\u8ba1\uff0c\u91c7\u7528\u66f4\u597d\u7684\u5185\u5b58\u7ba1\u7406\u7b56\u7565\uff0c\u786e\u4fdd\u53ca\u65f6\u91ca\u653e\u4e0d\u518d\u4f7f\u7528\u7684\u5806\u5916\u5185\u5b58\u3002<\/li>\n<\/ul>\n<p>\u8981\u6ce8\u610f\u7684\u662f\uff0c\u7531\u4e8e\u5806\u5916\u5185\u5b58\u4e0d\u53d7Java\u865a\u62df\u673a\u7684\u5783\u573e\u56de\u6536\u673a\u5236\u7ba1\u7406\uff0c\u56e0\u6b64\u5728\u4f7f\u7528\u5806\u5916\u5185\u5b58\u65f6\uff0c\u5f00\u53d1\u8005\u9700\u8981\u683c\u5916\u5c0f\u5fc3\u5730\u8fdb\u884c\u7ba1\u7406\uff0c\u4ee5\u907f\u514d\u53d1\u751f\u5185\u5b58\u6cc4\u6f0f\u548c\u6ea2\u51fa\u95ee\u9898\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5806\u5916\u5185\u5b58\uff08Off-Heap Memory\uff09\u662f\u6307\u4e0d\u7531Java\u865a\u62df\u673a\u76f4\u63a5\u7ba1\u7406\u7684\u5185\u5b58\uff0c\u901a\u5e38\u662f\u901a\u8fc7ByteBuffer [&hellip;]<\/p>\n","protected":false},"author":9,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[119],"tags":[],"class_list":["post-11262","post","type-post","status-publish","format-standard","hentry","category-jvm"],"_links":{"self":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/11262","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/comments?post=11262"}],"version-history":[{"count":2,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/11262\/revisions"}],"predecessor-version":[{"id":16977,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/11262\/revisions\/16977"}],"wp:attachment":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/media?parent=11262"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/categories?post=11262"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/tags?post=11262"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}