{"id":16,"date":"2017-04-19T17:27:42","date_gmt":"2017-04-19T09:27:42","guid":{"rendered":"http:\/\/www.myway5.com\/?p=16"},"modified":"2017-04-19T18:14:46","modified_gmt":"2017-04-19T10:14:46","slug":"object-memory-difference-between-java-and-c-plus-plus","status":"publish","type":"post","link":"https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/object-memory-difference-between-java-and-c-plus-plus\/","title":{"rendered":"c++\u548cJava\u7684\u5bf9\u8c61\u5185\u5b58\u5f02\u540c"},"content":{"rendered":"<p>##\u524d\u8a00<\/p>\n<p>\u597d\u4e45\u90fd\u6ca1\u6709\u5199\u535a\u5ba2\u4e86\u3002\u7ecf\u8fc7\u4e00\u6bb5\u65f6\u95f4\u7684\u5b9e\u4e60\uff0c\u6536\u83b7\u4e0a\u611f\u89c9\u5e76\u4e0d\u662f\u5f88\u5927\uff0c\u8fd8\u597d\u81ea\u5df1\u4e5f\u6709\u770b\u4e00\u4e9b\u4e1c\u897f\u3002\u56e0\u4e3a\u6bd5\u4e1a\u8bbe\u8ba1\u505a\u7684\u662fc++\u65b9\u9762\u7684\u7f16\u7a0b\uff0c\u7b97\u662f\u521d\u63a2c++\u7684\u5185\u5bb9\u3002\u8fd9\u91cc\u7b80\u5355\u8bb0\u5f55\u81ea\u5df1\u5bf9c++\u548cjava\u7684\u5bf9\u8c61\u5185\u5b58\u533a\u522b\uff0c\u8c08\u8c08c++\u4e3a\u4ec0\u4e48\u6027\u80fd\u8981\u6bd4java\u9ad8\u3002\u60f3\u5230\u54ea\u91cc\u5c31\u8bb0\u5230\u54ea\u91cc\uff0c\u56e0\u4e3a\u5f88\u591a\u4e1c\u897f\u81ea\u5df1\u4e5f\u8981\u67e5\u8bc1\u624d\u80fd\u786e\u5b9a\u3002<\/p>\n<p>##1.\u6808\u548c\u5806<\/p>\n<p>\u6808\u548c\u5806\u5728\u6570\u636e\u7ed3\u6784\u4e0a\u662f\u4e24\u79cd\u4e0d\u540c\u7684\u7ed3\u6784\uff0c\u6808\u7684\u7279\u70b9\u662f\u5148\u8fdb\u540e\u51fa\uff0c\u800c\u5806\u5219\u53ef\u4ee5\u770b\u505a\u662f\u4e00\u5927\u5806\u6570\u636e\u7684\u96c6\u5408\u3002\u5728c++\u548cJava\u7684\u5185\u5b58\u4e2d\uff0c\u4e5f\u6709\u5806\u548c\u6808\u7684\u6982\u5ff5\u3002<br \/>\n\u9996\u5148\u7406\u89e3\u4e00\u4e0b\uff0c\u5185\u5b58\u4e2d\u6808\u4e2d\u7684\u6bcf\u4e00\u4e2a\u5143\u7d20\u90fd\u88ab\u79f0\u4e3a\u6808\u5e27\uff0c\u6bcf\u4e2a\u6808\u5e27\u4e2d\u5b58\u50a8\u4e00\u4e2a\u65b9\u6cd5(function)\u4e2d\u7684\u7528\u5230\u7684\u53d8\u91cf\u5185\u5b58\u3002\u7a0b\u5e8f\u6267\u884c\u65f6\uff0c\u5c31\u662f\u4e00\u4e2a\u6808\u4e2d\u7684\u6bcf\u4e00\u5e27\u88ab\u8bfb\u53d6\u6267\u884c\u7684\u8fc7\u7a0b\u3002\u5806\u5219\u662f\u4e3b\u8981\u7528\u6765\u5b58\u50a8\u5bf9\u8c61\u3002\u90a3\u4e48\u5728c++\u548cjava\u4e2d\u5230\u5e95\u6709\u4ec0\u4e48\u4e0d\u540c\u5462?<\/p>\n<p>&#8220;`c++<br \/>\nobject* processObject(int param){<br \/>\n     object obj;<br \/>\n    obj.param = param;<br \/>\n    return &amp;obj;<br \/>\n}<\/p>\n<p>int main(){<br \/>\n    object* obj = processObject(10);<br \/>\n    obj-&gt;do_something();        \/\/1<br \/>\n}<\/p>\n<p>&lt;pre&gt;&lt;code&gt;&lt;br \/&gt;1\u5904\u662f\u4f1a\u51fa\u73b0\u4e00\u4e2a\u7a7a\u6307\u9488\u9519\u8bef\u7684\u3002\u800c\u5982\u679c\u8fd9\u662f\u4e00\u6bb5java\u7684\u4ee3\u7801\u5219\u5b8c\u5168\u6ca1\u6709\u95ee\u9898\u3002<\/p>\n<p>\u5728c++\u548cjava\u4e2d\uff0c\u4e00\u4e2a\u6808\u5e27\u88ab\u6267\u884c\u5b8c\uff0c\u8fd9\u90e8\u5206\u5185\u5b58\u5c31\u76f4\u63a5\u88ab\u91ca\u653e\u4e86\u3002\u800c\u5728c++\u4e2d\uff0c\u6240\u6709\u901a\u8fc7\u58f0\u660e\u4ea7\u751f\u7684\u5bf9\u8c61\u90fd\u662f\u5728\u6808\u4e0a\u5f00\u8f9f\u5185\u5b58\u7a7a\u95f4\uff0c\u6240\u4ee5\u51fd\u6570\u6267\u884c\u5b8c\u540e\u8fd9\u4e2a\u5bf9\u8c61\u4e5f\u5c31\u88ab\u91ca\u653e\u4e86\uff0c\u90a3\u4e48\u8fd4\u56de\u51fa\u6765\u5c31\u662f\u4e00\u4e2a\u7a7a\u6307\u9488\u4e86\u3002\u53ea\u6709\u901a\u8fc7new\u751f\u6210\u7684\u5bf9\u8c61\u624d\u4f1a\u5728\u5806\u4e2d\u7533\u8bf7\u7a7a\u95f4\uff0c\u56e0\u6b64\u901a\u8fc7new\u51fa\u6765\u7684\u5bf9\u8c61\u90fd\u9700\u8981\u5728\u4e0d\u7528\u65f6\u624b\u52a8\u91ca\u653e\u5185\u5b58\uff0c\u4e0d\u7136\u5c31\u4f1a\u5185\u5b58\u6cc4\u9732\u3002\u800c\u5728java\u4e2d\uff0c\u5bf9\u8c61\u662f\u5728\u5806\u4e2d\u751f\u6210\u7684(JDK7\u4e2d\u7684\u5b57\u7b26\u4e32\u662f\u5728\u5e38\u91cf\u6c60\u4e2d\uff0cint\u7b49\u5b57\u9762\u503c\u5728\u9650\u5b9a\u8303\u56f4\u5185\u4e5f\u4f1a\u5728\u5e38\u91cf\u6c60\u4e2d\u7533\u8bf7\u5185\u5b58),\u6240\u6709\u65b9\u6cd5\u5185\u7684\u5bf9\u8c61\u90fd\u662f\u4e00\u4e2a\u6307\u5411\u5806\u4e2d\u76f8\u5e94\u5bf9\u8c61\u7684\u6307\u9488\uff08\u6ce8\u610f\u662f\u6307\u9488\u800c\u4e0d\u662f\u5f15\u7528\uff0c\u5f88\u591a\u4eba\u8ba4\u4e3ajava\u4e2d\u5411\u65b9\u6cd5\u4f20\u9012\u53c2\u6570\u662f\u5f15\u7528\u4f20\u9012\uff0c\u4f46\u5176\u5b9e\u662f\u503c\u4f20\u9012\uff0c\u53ea\u4e0d\u8fc7\u8fd9\u4e2a\u503c\u662f\u6307\u5411\u5bf9\u8c61\u7684\u6307\u9488\uff09\u3002\u800c\u5728java\u4e2d\u4e0d\u9700\u8981\u624b\u52a8\u91ca\u653e\u5185\u5b58\u5219\u662f\u56e0\u4e3aJava\u62e5\u6709GC\u673a\u5236(Garbage collect,\u5783\u573e\u56de\u6536)\u3002\u8fd9\u4e2a\u5728\u4e4b\u540e\u518d\u8c08\u3002<\/p>\n<p>##2 java\u7684\u5f3a\u5f31\u5f15\u7528\u548cc++\u7684\u667a\u80fd\u6307\u9488<\/p>\n<p>java\u7684\u5f3a\u5f31\u5f15\u7528\u548cc++\u7684\u667a\u80fd\u6307\u9488\u90fd\u662f\u5728\u5e0c\u671b\u53ef\u4ee5\u66f4\u597d\u7684\u8fdb\u884c\u5185\u5b58\u7ba1\u7406\u7684\u524d\u63d0\u4e0b\u51fa\u73b0\u7684\uff0cjava\u7684\u5f3a\u5f31\u5f15\u7528\u53ef\u4ee5\u5e2e\u52a9GC\u673a\u5236\u8fdb\u884c\u7c92\u5ea6\u66f4\u7ec6\u7684\u5185\u5b58\u56de\u6536\uff0c\u800cc++\u7684\u667a\u80fd\u6307\u9488\u5219\u662f\u8ba9\u6ca1\u6709GC\u673a\u5236\u7684c++\u6709\u4e86\u4e00\u5b9a\u80fd\u529b\u7684\u81ea\u52a8\u91ca\u653e\u5185\u5b58\u7684\u80fd\u529b\u3002<br \/>\n###a. java\u7684\u5f3a\u5f31\u5f15\u7528<br \/>\njava\u7684\u5f15\u7528\u5171\u6709\u56db\u79cd,\u5206\u522b\u4e3a\u5f3a\u5f15\u7528\uff08Strong Reference\uff09\u3001\u8f6f\u5f15\u7528\uff08Soft Reference\uff09\u3001\u5f31\u5f15\u7528\uff08Weak Reference\uff09\u3001\u865a\u5f15\u7528\uff08Phantom Reference\uff09\u3002<br \/>\n\u4e4b\u6240\u4ee5\u5b9a\u4e49\u51fa\u8fd9\u4e48\u591a\u5f15\u7528\uff0c\u662f\u5e0c\u671b\u5728GC\u53d1\u751f\u65f6\uff0c\u53ef\u4ee5\u66f4\u7075\u6d3b\u7684\u8fdb\u884c\u5bf9\u8c61\u7684\u9500\u6bc1\u3002<\/p>\n<p>\u5f3a\u5f15\u7528\u5c31\u662f\u901a\u8fc7new\u51fa\u6765\u7684\u5bf9\u8c61\uff0c\u5f3a\u5f15\u7528\u8868\u793a\u7684\u90fd\u662f\u5fc5\u9700\u7684\u5bf9\u8c61\uff0c\u8fd9\u662f\u65e0\u8bba\u5982\u4f55\u90fd\u4e0d\u4f1a\u88ab\u56de\u6536\u7684\u3002<\/p>\n<p>\u800c\u8f6f\u5f15\u7528\u5219\u8868\u793a\u6709\u7528\u4f46\u975e\u5fc5\u9700\u7684\u5bf9\u8c61\u3002\u5f53\u7cfb\u7edf\u5185\u5b58\u4e0d\u591f\u5c06\u8981\u53d1\u751f\u5185\u5b58\u6ea2\u51fa\u5f02\u5e38\u7684\u65f6\u5019\uff0c\u4f1a\u5c06\u8f6f\u5f15\u7528\u7684\u5bf9\u8c61\u5217\u5165\u56de\u6536\u8303\u56f4\uff0c\u8fdb\u884c\u4e8c\u6b21\u56de\u6536\u3002\u53ea\u6709\u8fd9\u6b21\u56de\u6536\u4ecd\u7136\u5185\u5b58\u4e0d\u8db3\u624d\u4f1a\u629b\u51fa\u5185\u5b58\u6ea2\u51fa\u5f02\u5e38\u3002JDK1.2\u4e4b\u540e\u63d0\u4f9b\u4e86SoftReference\u7c7b\u6765\u5b9e\u73b0\u8fd9\u4e2a\u3002<\/p>\n<p>\u5f31\u5f15\u7528\u4e5f\u7528\u6765\u8868\u793a\u975e\u5fc5\u9700\u7684\u5bf9\u8c61\uff0c\u4e0d\u540c\u7684\u662f\uff0c\u8fd9\u4e2a\u5f15\u7528\u5e76\u4e0d\u80fd\u5e2e\u52a9\u5bf9\u8c61\u8eb2\u8fc7\u4efb\u4f55\u7684GC\uff0c\u4e5f\u5c31\u662f\u8bf4\u65e0\u8bba\u5982\u4f55\uff0c\u53d1\u751fGC\u65f6\u8fd9\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u88ab\u56de\u6536\uff0c\u5f31\u5f15\u7528\u7684\u552f\u4e00\u4f5c\u7528\u5c31\u662f\u7528\u6765\u53d6\u5f97\u4e00\u4e2a\u5bf9\u8c61\u5b9e\u4f8b\u3002JDK1.2\u4e4b\u540e\u63d0\u4f9b\u4e86WeakReference\u7c7b\u6765\u5b9e\u73b0\u8fd9\u4e2a\u3002<\/p>\n<p>\u7efc\u5408\u4e0a\u8ff0\uff0c\u865a\u5f15\u7528\u7684\u5b58\u5728\u4e5f\u6bd4\u8f83\u6e05\u6670\u4e86\u3002\u5b83\u4e0d\u4ec5\u4e0d\u80fd\u5e2e\u52a9\u5bf9\u8c61\u8eb2\u8fc7GC,\u751a\u81f3\u4e0d\u80fd\u53d6\u5f97\u5bf9\u8c61\u7684\u5b9e\u4f8b\u3002\u552f\u4e00\u5b58\u5728\u7684\u7528\u5904\u5c31\u662f\u5f53\u5176\u5f15\u7528\u7684\u5bf9\u8c61\u88abGC\u56de\u6536\u65f6\u4f1a\u6536\u5230\u4e00\u4e2a\u7cfb\u7edf\u7684\u901a\u77e5\u3002JDK1.2\u4e4b\u540e\u4f7f\u7528PhantomReference\u7c7b\u6765\u5b9e\u73b0\u3002<\/p>\n<p>###b. C++\u7684\u667a\u80fd\u6307\u9488<br \/>\n\u76f8\u6bd4\u4e8eJava\u7684GC\u673a\u5236\u4ee5\u53ca\u4e3aGC\u670d\u52a1\u7684\u5404\u79cd\u5f15\u7528\uff0cC++\u7684\u667a\u80fd\u6307\u9488\u5219\u7a0d\u663e\u7b80\u5355\u3002\u4f46\u662f\u8fd9\u4e2a\u770b\u4f3c\u7b80\u5355\u7684c++\u7684\u667a\u80fd\u6307\u9488\uff0c\u5bf9\u4e8ec++\u6765\u8bf4\u610f\u4e49\u4e5f\u8bb8\u5e76\u4e0d\u662f\u90a3\u4e48\u4f4e\u3002\u5728\u6211\u7684\u7406\u89e3\u4e2d\uff0cc++\u4e4b\u6240\u4ee5\u5b9e\u7528\uff0c\u56e0\u4e3a\u76f8\u5bf9\u4e8ec\uff0cc++\u6709\u7740\u4e30\u5bcc\u9ad8\u6548\u7684STL\u5e93\u548c\u88ab\u5927\u591a\u6570\u5f00\u53d1\u8005\u63a5\u53d7\u7684OOP\u3002\u5bf9\u4e8e\u4e00\u4e2a\u5de8\u5927\u7684\u9879\u76ee\u6765\u8bf4\uff0cOOP\u5f80\u5f80\u53ef\u4ee5\u66f4\u597d\u7684\u5e2e\u52a9\u7cfb\u7edf\u6a21\u5757\u5316\uff0c\u964d\u4f4e\u8026\u5408\uff0c\u800cSTL\u5e93\u5219\u662f\u5f00\u53d1\u8005\u8fdb\u884c\u9ad8\u6548\u5de5\u4f5c\u7684\u57fa\u7840\u3002\u76f8\u5bf9\u4e8eJava,\u5355\u5355\u4ecec++\u6ca1\u6709GC\u673a\u5236\uff0c\u5c31\u610f\u5473\u7740\u5b83\u6709\u7740\u66f4\u9ad8\u7684\u6027\u80fd\uff0c\u53e6\u5916Java\u7684\u865a\u62df\u673a\u4e5f\u662f\u5f71\u54cd\u6027\u80fd\u7684\u4e00\u4e2a\u65b9\u9762\u3002\u53ef\u4e5f\u662f\u56e0\u4e3ac++\u6ca1\u6709GC\u673a\u5236\uff0c\u5bf9\u4e8e\u4e00\u4e2a\u591a\u4eba\u5408\u4f5c\u7684\u5de8\u5927\u7684\u9879\u76ee\u6765\u8bf4\uff0c\u5185\u5b58\u6cc4\u9732\u5219\u662f\u9762\u4e34\u7684\u9996\u8981\u95ee\u9898\u3002\u4e3e\u4e2a\u5f88\u4f4e\u7aef\u7684\u4f8b\u5b50<br \/>\n&#8220;`c++<br \/>\n    class Example{<br \/>\n        Mysql* getMysqlConnect(){<br \/>\n            Mysql* mysql = new Mysql;<br \/>\n            return mysql;<br \/>\n        }<br \/>\n    };<br \/>\n<\/code><\/pre>\n<p>\u4e00\u4e2a\u9879\u76ee\u4e2d\u6240\u6709\u7684mysql\u5bf9\u8c61\u6307\u9488\u90fd\u901a\u8fc7\u4e0a\u9762\u7684getMysqlConnect()\u83b7\u53d6,\u770b\u4f3c\u6ca1\u6709\u95ee\u9898\uff0c\u4f46\u662f\u6ca1\u6709\u4eba\u6562\u4fdd\u8bc1\u4e00\u4e2a\u9879\u76ee\u4e2d\u6240\u6709\u4f7f\u7528\u8fd9\u4e2a\u65b9\u6cd5\u7684\u4eba\u90fd\u4f1a\u5728\u4f7f\u7528\u5b8cmysql\u5bf9\u8c61\u540e\uff0c\u624b\u52a8\u5c06\u5176\u91ca\u653e\u3002\u56e0\u6b64\u8fd9\u91cc\u9700\u8981\u4e00\u4e2ashared_ptr\u6216\u8005unique_ptr\u53bb\u5305\u88c5\u4e00\u4e0b\u6307\u9488\uff0c\u8fd9\u6837\u8c03\u7528\u51fd\u6570\u7684\u4eba\u5c31\u4e0d\u9700\u8981\u5728\u5916\u90e8\u91ca\u653e\u5bf9\u8c61\u5185\u5b58\uff0c\u4e5f\u5c31\u907f\u514d\u4e86\u5185\u5b58\u6cc4\u9732\u7684\u95ee\u9898\u3002\u5f53\u7136\u5728\u4f7f\u7528shared_ptr\u65f6\u4e5f\u4e00\u5b9a\u8981\u6ce8\u610f\uff0c\u56e0\u4e3a\u53ef\u80fd\u4f1a\u51fa\u73b0\u5faa\u73af\u5f15\u7528\u7684\u95ee\u9898\uff0c\u5faa\u73af\u5f15\u7528\u5219\u4f1a\u5bfc\u81f4\u5bf9\u8c61\u5185\u5b58\u4e00\u76f4\u4e0d\u88ab\u91ca\u653e\u3002<br \/>\n\u5f53\u7136\u4e86\uff0c\u4e0a\u9762\u7684\u4f8b\u5b50\u53ea\u662f\u4e3a\u4e86\u8bf4\u660e\u8fd9\u4e2a\u4f8b\u5b50\u800c\u5217\u4e3e\u51fa\u6765\u7684\uff0c\u4e8b\u5b9e\u4e0a\u53ef\u4ee5\u76f4\u63a5\u8fd4\u56de\u5bf9\u8c61\u800c\u4e0d\u662f\u6307\u9488\u3002<br \/>\n<code>c++<br \/>\n    class Example{<br \/>\n        Mysql getMysqlConnect(){<br \/>\n            Mysql mysql;<br \/>\n            return mysql;<br \/>\n        }<br \/>\n    };<\/code><br \/>\n\u8fd9\u91cc\u6211\u4e00\u5f00\u59cb\u4ee5\u4e3a\u662f\u4f1a\u5c06\u5bf9\u8c61\u590d\u5236\u4e00\u904d\u8fd4\u56de\u51fa\u6765\uff0c\u4f46\u4e8b\u5b9e\u4e0a\u5728c++11\u4e2d\u6709\u4e86\u79fb\u52a8\u8bed\u4e49\uff0c\u5373\u8fd9\u79cd\u5728\u62f7\u8d1d\u8bed\u4e49\u548c\u79fb\u52a8\u8bed\u4e49\u4e2d\uff0c\u4f1a\u4f18\u5148\u4f7f\u7528\u79fb\u52a8\u8bed\u4e49\u6765\u5c06mysql\u5bf9\u8c61\u4ece\u65b9\u6cd5\u4e2d\u79fb\u51fa\u6765\uff0c\u800c\u4e0d\u662f\u62f7\u8d1dmysql\u5bf9\u8c61\u8fd4\u56de\uff0c\u5e76\u628a\u65b9\u6cd5\u4e2d\u7684\u5bf9\u8c61\u5220\u9664\u3002<br \/>\n##3 c++\u5982\u4f55\u5c3d\u91cf\u907f\u514d\u5185\u5b58\u6cc4\u9732<\/p>\n<p>\u540e\u5929\u518d\u5199\u5566<\/p>\n","protected":false},"excerpt":{"rendered":"<p>##\u524d\u8a00 \u597d\u4e45\u90fd\u6ca1\u6709\u5199\u535a\u5ba2\u4e86\u3002\u7ecf\u8fc7\u4e00\u6bb5\u65f6\u95f4\u7684\u5b9e\u4e60\uff0c\u6536\u83b7\u4e0a\u611f\u89c9\u5e76\u4e0d\u662f\u5f88\u5927\uff0c\u8fd8\u597d\u81ea\u5df1\u4e5f\u6709\u770b\u4e00\u4e9b\u4e1c\u897f\u3002\u56e0\u4e3a\u6bd5\u4e1a\u8bbe\u8ba1\u505a &hellip; <a href=\"https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/object-memory-difference-between-java-and-c-plus-plus\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">c++\u548cJava\u7684\u5bf9\u8c61\u5185\u5b58\u5f02\u540c<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,5],"tags":[],"class_list":["post-16","post","type-post","status-publish","format-standard","hentry","category-cplusplus","category-java"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>c++\u548cJava\u7684\u5bf9\u8c61\u5185\u5b58\u5f02\u540c - \u4e00\u53ea\u5b89\u9759\u7684\u732b<\/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.myway5.com\/index.php\/2017\/04\/19\/object-memory-difference-between-java-and-c-plus-plus\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"c++\u548cJava\u7684\u5bf9\u8c61\u5185\u5b58\u5f02\u540c - \u4e00\u53ea\u5b89\u9759\u7684\u732b\" \/>\n<meta property=\"og:description\" content=\"##\u524d\u8a00 \u597d\u4e45\u90fd\u6ca1\u6709\u5199\u535a\u5ba2\u4e86\u3002\u7ecf\u8fc7\u4e00\u6bb5\u65f6\u95f4\u7684\u5b9e\u4e60\uff0c\u6536\u83b7\u4e0a\u611f\u89c9\u5e76\u4e0d\u662f\u5f88\u5927\uff0c\u8fd8\u597d\u81ea\u5df1\u4e5f\u6709\u770b\u4e00\u4e9b\u4e1c\u897f\u3002\u56e0\u4e3a\u6bd5\u4e1a\u8bbe\u8ba1\u505a &hellip; \u7ee7\u7eed\u9605\u8bfbc++\u548cJava\u7684\u5bf9\u8c61\u5185\u5b58\u5f02\u540c\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/object-memory-difference-between-java-and-c-plus-plus\/\" \/>\n<meta property=\"og:site_name\" content=\"\u4e00\u53ea\u5b89\u9759\u7684\u732b\" \/>\n<meta property=\"article:published_time\" content=\"2017-04-19T09:27:42+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-04-19T10:14:46+00:00\" \/>\n<meta name=\"author\" content=\"jiangpengfei\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"jiangpengfei\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/object-memory-difference-between-java-and-c-plus-plus\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/object-memory-difference-between-java-and-c-plus-plus\/\"},\"author\":{\"name\":\"jiangpengfei\",\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685\"},\"headline\":\"c++\u548cJava\u7684\u5bf9\u8c61\u5185\u5b58\u5f02\u540c\",\"datePublished\":\"2017-04-19T09:27:42+00:00\",\"dateModified\":\"2017-04-19T10:14:46+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/object-memory-difference-between-java-and-c-plus-plus\/\"},\"wordCount\":136,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685\"},\"articleSection\":[\"c++\",\"java\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/object-memory-difference-between-java-and-c-plus-plus\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/object-memory-difference-between-java-and-c-plus-plus\/\",\"url\":\"https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/object-memory-difference-between-java-and-c-plus-plus\/\",\"name\":\"c++\u548cJava\u7684\u5bf9\u8c61\u5185\u5b58\u5f02\u540c - \u4e00\u53ea\u5b89\u9759\u7684\u732b\",\"isPartOf\":{\"@id\":\"https:\/\/www.myway5.com\/#website\"},\"datePublished\":\"2017-04-19T09:27:42+00:00\",\"dateModified\":\"2017-04-19T10:14:46+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/object-memory-difference-between-java-and-c-plus-plus\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/object-memory-difference-between-java-and-c-plus-plus\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/object-memory-difference-between-java-and-c-plus-plus\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.myway5.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"c++\u548cJava\u7684\u5bf9\u8c61\u5185\u5b58\u5f02\u540c\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.myway5.com\/#website\",\"url\":\"https:\/\/www.myway5.com\/\",\"name\":\"\u4e00\u53ea\u5b89\u9759\u7684\u732b\",\"description\":\"\u60f3\u5565\u5462\",\"publisher\":{\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.myway5.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-Hans\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685\",\"name\":\"jiangpengfei\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/f8c7de757f6e0247412bcfd31b7c2271?s=96&d=monsterid&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/f8c7de757f6e0247412bcfd31b7c2271?s=96&d=monsterid&r=g\",\"caption\":\"jiangpengfei\"},\"logo\":{\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/image\/\"},\"url\":\"https:\/\/www.myway5.com\/index.php\/author\/joyme\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"c++\u548cJava\u7684\u5bf9\u8c61\u5185\u5b58\u5f02\u540c - \u4e00\u53ea\u5b89\u9759\u7684\u732b","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.myway5.com\/index.php\/2017\/04\/19\/object-memory-difference-between-java-and-c-plus-plus\/","og_locale":"zh_CN","og_type":"article","og_title":"c++\u548cJava\u7684\u5bf9\u8c61\u5185\u5b58\u5f02\u540c - \u4e00\u53ea\u5b89\u9759\u7684\u732b","og_description":"##\u524d\u8a00 \u597d\u4e45\u90fd\u6ca1\u6709\u5199\u535a\u5ba2\u4e86\u3002\u7ecf\u8fc7\u4e00\u6bb5\u65f6\u95f4\u7684\u5b9e\u4e60\uff0c\u6536\u83b7\u4e0a\u611f\u89c9\u5e76\u4e0d\u662f\u5f88\u5927\uff0c\u8fd8\u597d\u81ea\u5df1\u4e5f\u6709\u770b\u4e00\u4e9b\u4e1c\u897f\u3002\u56e0\u4e3a\u6bd5\u4e1a\u8bbe\u8ba1\u505a &hellip; \u7ee7\u7eed\u9605\u8bfbc++\u548cJava\u7684\u5bf9\u8c61\u5185\u5b58\u5f02\u540c","og_url":"https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/object-memory-difference-between-java-and-c-plus-plus\/","og_site_name":"\u4e00\u53ea\u5b89\u9759\u7684\u732b","article_published_time":"2017-04-19T09:27:42+00:00","article_modified_time":"2017-04-19T10:14:46+00:00","author":"jiangpengfei","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"jiangpengfei","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/object-memory-difference-between-java-and-c-plus-plus\/#article","isPartOf":{"@id":"https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/object-memory-difference-between-java-and-c-plus-plus\/"},"author":{"name":"jiangpengfei","@id":"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685"},"headline":"c++\u548cJava\u7684\u5bf9\u8c61\u5185\u5b58\u5f02\u540c","datePublished":"2017-04-19T09:27:42+00:00","dateModified":"2017-04-19T10:14:46+00:00","mainEntityOfPage":{"@id":"https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/object-memory-difference-between-java-and-c-plus-plus\/"},"wordCount":136,"commentCount":0,"publisher":{"@id":"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685"},"articleSection":["c++","java"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/object-memory-difference-between-java-and-c-plus-plus\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/object-memory-difference-between-java-and-c-plus-plus\/","url":"https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/object-memory-difference-between-java-and-c-plus-plus\/","name":"c++\u548cJava\u7684\u5bf9\u8c61\u5185\u5b58\u5f02\u540c - \u4e00\u53ea\u5b89\u9759\u7684\u732b","isPartOf":{"@id":"https:\/\/www.myway5.com\/#website"},"datePublished":"2017-04-19T09:27:42+00:00","dateModified":"2017-04-19T10:14:46+00:00","breadcrumb":{"@id":"https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/object-memory-difference-between-java-and-c-plus-plus\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/object-memory-difference-between-java-and-c-plus-plus\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/object-memory-difference-between-java-and-c-plus-plus\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.myway5.com\/"},{"@type":"ListItem","position":2,"name":"c++\u548cJava\u7684\u5bf9\u8c61\u5185\u5b58\u5f02\u540c"}]},{"@type":"WebSite","@id":"https:\/\/www.myway5.com\/#website","url":"https:\/\/www.myway5.com\/","name":"\u4e00\u53ea\u5b89\u9759\u7684\u732b","description":"\u60f3\u5565\u5462","publisher":{"@id":"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.myway5.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-Hans"},{"@type":["Person","Organization"],"@id":"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685","name":"jiangpengfei","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.myway5.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/f8c7de757f6e0247412bcfd31b7c2271?s=96&d=monsterid&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f8c7de757f6e0247412bcfd31b7c2271?s=96&d=monsterid&r=g","caption":"jiangpengfei"},"logo":{"@id":"https:\/\/www.myway5.com\/#\/schema\/person\/image\/"},"url":"https:\/\/www.myway5.com\/index.php\/author\/joyme\/"}]}},"views":3903,"_links":{"self":[{"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/posts\/16","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/comments?post=16"}],"version-history":[{"count":1,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/posts\/16\/revisions"}],"predecessor-version":[{"id":17,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/posts\/16\/revisions\/17"}],"wp:attachment":[{"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/media?parent=16"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/categories?post=16"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/tags?post=16"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}