{"id":137725,"date":"2019-03-06T08:03:43","date_gmt":"2019-03-06T00:03:43","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=137725"},"modified":"2019-02-25T11:04:52","modified_gmt":"2019-02-25T03:04:52","slug":"help-linux-memory","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/help-linux-memory.html","title":{"rendered":"\u5e2e\u52a9\u4f60\u68c0\u67e5Linux\u7cfb\u7edf\u5185\u5b58\u53ca\u5176\u4f7f\u7528\u60c5\u51b5\u7684\u547d\u4ee4"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u6709\u8bb8\u591a\u529e\u6cd5\u53ef\u4ee5\u83b7\u5f97Linux\u7cfb\u7edf\u4e0a\u6240\u5b89\u88c5\u5185\u5b58\u7684\u4fe1\u606f\uff0c\u5e76\u67e5\u770b\u5176\u4e2d\u6709\u591a\u5c11\u5185\u5b58\u6b63\u5728\u4f7f\u7528\u4e2d\u3002\u6709\u7684\u547d\u4ee4\u4f1a\u5c55\u793a\u5927\u91cf\u7684\u7ec6\u8282\uff0c\u800c\u6709\u7684\u547d\u4ee4\u5219\u63d0\u4f9b\u4e86\u7b80\u6d01(\u4f46\u4e0d\u4e00\u5b9a\u5bb9\u6613\u7406\u89e3)\u7684\u7ed3\u679c\u3002\u5728\u8fd9\u7bc7\u6587\u7ae0\u4e2d\u5c06\u4ecb\u7ecd\u4e00\u4e9b\u66f4\u6709\u7528\u7684\u5de5\u5177\uff0c\u5e2e\u52a9\u4f60\u68c0\u67e5\u5185\u5b58\u53ca\u5176\u4f7f\u7528\u60c5\u51b5\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\"\"<\/p>\n

\u4e0d\u8fc7\uff0c\u5728\u8fdb\u4e00\u6b65\u8ba8\u8bba\u4e4b\u524d\uff0c\u6211\u4eec\u8981\u5148\u56de\u987e\u4e00\u4e9b\u57fa\u672c\u77e5\u8bc6\u3002\u7269\u7406\u5185\u5b58\u548c\u865a\u62df\u5185\u5b58\u662f\u4e0d\u4e00\u6837\u7684\uff0c\u540e\u8005\u5305\u62ec\u914d\u7f6e\u4e3a\u4ea4\u6362\u533a\u7684\u78c1\u76d8\u7a7a\u95f4\u3002\u4ea4\u6362\u533a\u53ef\u80fd\u5305\u62ec\u4e3a\u6b64\u7528\u9014\u9884\u7559\u7684\u5206\u533a\uff0c\u6216\u8005\u90a3\u4e9b\u4e3a\u6dfb\u52a0\u5230\u65b0\u7684\u4ea4\u6362\u533a\u800c\u521b\u5efa\u7684\u6587\u4ef6\u2014\u2014\u5f53\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u5206\u533a\u5e76\u4e0d\u5b9e\u9645\u65f6\u3002\u6709\u4e9bLinux\u547d\u4ee4\u63d0\u4f9b\u4e86\u8fd9\u4e24\u65b9\u9762\u7684\u4fe1\u606f\u3002<\/p>\n

\u4ea4\u6362\u533a\u901a\u8fc7\u63d0\u4f9b\u78c1\u76d8\u7a7a\u95f4\u6765\u6269\u5c55\u5185\u5b58\uff0c\u8fd9\u4e9b\u78c1\u76d8\u7a7a\u95f4\u53ef\u7528\u4e8e\u5b58\u653e\u90a3\u4e9b\u7269\u7406\u5185\u5b58\u5df2\u6ee1\u65f6\u79fb\u52a8\u5230\u78c1\u76d8\u7684\u975e\u6d3b\u52a8\u9875\u3002<\/p>\n

\u5728\u5185\u5b58\u7ba1\u7406\u4e2d\u8d77\u5230\u4f5c\u7528\u7684\u4e00\u4e2a\u6587\u4ef6\u662f\/proc\/kcore\uff0c\u8fd9\u4e2a\u6587\u4ef6\u770b\u8d77\u6765\u50cf\u4e00\u4e2a\u666e\u901a\u7684(\u867d\u7136\u975e\u5e38\u5927)\u6587\u4ef6\uff0c\u4f46\u662f\u5b83\u6839\u672c\u4e0d\u5360\u7528\u78c1\u76d8\u7a7a\u95f4\u3002\u5c31\u50cf\/proc\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u4e00\u6837\uff0c\u5b83\u662f\u4e00\u4e2a\u865a\u62df\u6587\u4ef6\u3002<\/p>\n

\u6709\u8da3\u7684\u662f\uff0c\u4e0b\u9762\u67e5\u8be2\u7684\u4e24\u4e2a\u7cfb\u7edf\u6ca1\u6709\u5b89\u88c5\u76f8\u540c\u6570\u91cf\u7684\u5185\u5b58\uff0c\u4f46\u662f\/proc\/kcore<\/code>\u7684\u5927\u5c0f\u5728\u8fd9\u4e24\u4e2a\u7cfb\u7edf\u4e0a\u662f\u76f8\u540c\u7684\u3002\u7b2c\u4e00\u4e2a\u7cfb\u7edf\u5b89\u88c5\u4e864 GB\u5185\u5b58\uff0c\u7b2c\u4e8c\u4e2a\u67096 GB\u3002<\/p>\n

\u8be5\u6587\u4ef6\u7684\u5927\u5c0f\u8868\u793a\u53ef\u7528\u865a\u62df\u5185\u5b58\u7684\u6570\u91cf(\u53ef\u80fd\u52a0\u4e0a4K)\uff0c\u8fd9\u4e2a\u89e3\u91ca\u53ef\u80fd\u7ad9\u4e0d\u4f4f\u811a\u3002\u8fd9\u4e2a\u6570\u5b57\u8868\u660e\u8fd9\u4e9b\u7cfb\u7edf\u4e0a\u7684\u865a\u62df\u5185\u5b58\u662f128 TB!\u8fd9\u4e2a\u6570\u5b57\u4ee3\u886864\u4f4d\u7cfb\u7edf\u80fd\u591f\u5bfb\u5740\u7684\u5185\u5b58\u6570\u91cf\uff0c\u800c\u4e0d\u662f\u7cfb\u7edf\u4e0a\u7684\u53ef\u7528\u5185\u5b58\u6570\u91cf\u3002\u901a\u8fc7\u4ee5\u4e0b\u65b9\u5f0f\u8fdb\u884c\u8ba1\u7b97\uff0c\u518d\u52a0\u4e0a4 K\uff0c\u5c31\u53ef\u4ee5\u63a8\u5bfc\u51fa\u8fd9\u4e2a\u6570\u5b57\uff1a
\n\"\"<\/p>\n

\u53e6\u4e00\u4e2a\u66f4\u4eba\u6027\u5316\u7684\u68c0\u67e5\u5185\u5b58\u7684\u547d\u4ee4\u662ffree<\/code>\u547d\u4ee4\uff0c\u5b83\u53ef\u4ee5\u63d0\u4f9b\u4e00\u4e2a\u6613\u4e8e\u7406\u89e3\u7684\u5185\u5b58\u62a5\u544a\u3002<\/p>\n

\u4f7f\u7528-g<\/code>\u9009\u9879\uff0cfree<\/code>\u4ee5gb\u4e3a\u5355\u4f4d\u62a5\u544a\u8fd9\u4e9b\u503c\u3002<\/p>\n

\"\"<\/p>\n

\u4f7f\u7528-t<\/code>\u9009\u9879\uff0cfree<\/code>\u663e\u793a\u7684\u503c\u4e0e\u6ca1\u6709\u9009\u9879\u65f6\u663e\u793a\u7684\u503c\u76f8\u540c(\u4e0d\u8981\u6df7\u6dc6<\/code>-t<\/code>\u548ctb<\/code>)\uff0c\u4f46\u662f\u5728\u8f93\u51fa\u7684\u5e95\u90e8\u6dfb\u52a0\u4e86\u4e00\u884c\u3002<\/p>\n

\"\"<\/p>\n

\u5f53\u7136\uff0c\u4f60\u4e5f\u53ef\u4ee5\u540c\u65f6\u4f7f\u7528\u8fd9\u4e24\u4e2a\u9009\u9879\u3002<\/p>\n

\"\"<\/p>\n

\u5982\u679c\u4f60\u5e0c\u671b\u5f97\u5230\u201c\u8fd9\u4e2a\u7cfb\u7edf\u4e0a\u5b89\u88c5\u4e86\u591a\u5c11RAM\u201d\u7684\u7b54\u6848\uff0c\u90a3\u4e48\u4f60\u53ef\u80fd\u4f1a\u5bf9\u8fd9\u4e2a\u62a5\u544a\u611f\u5230\u5931\u671b\uff0c\u8fd9\u4e0e\u4e0a\u9762\u793a\u4f8b\u4e2d\u663e\u793a\u7684\u5177\u67096GB RAM\u7684\u7cfb\u7edf\u76f8\u540c\u3002\u5e76\u4e0d\u8868\u793a\u8fd9\u4e2a\u62a5\u544a\u662f\u9519\u7684\uff0c\u800c\u662f\u7cfb\u7edf\u5bf9\u5b83\u6240\u62e5\u6709\u7684\u5185\u5b58\u7684\u770b\u6cd5\u3002free\u547d\u4ee4\u8fd8\u63d0\u4f9b\u4e86\u6bcfX\u79d2(\u5728\u4e0b\u9762\u7684\u793a\u4f8b\u4e2d\u4e3a10\u79d2)\u66f4\u65b0\u4e00\u6b21\u7ed3\u679c\u7684\u9009\u9879\u3002<\/p>\n

\u4f7f\u7528-l, free\u547d\u4ee4\u53ef\u4ee5\u63d0\u4f9b\u9ad8\u5185\u5b58\u4f7f\u7528\u91cf\u548c\u4f4e\u5185\u5b58\u4f7f\u7528\u91cf\u3002<\/p>\n

\u67e5\u770b\u5185\u5b58\u7684\u53e6\u4e00\u4e2a\u529e\u6cd5\u662f\/proc\/meminfo\u6587\u4ef6\u3002\u4e0e\/proc\/kcore<\/code>\u7c7b\u4f3c\uff0c\u8fd9\u662f\u4e00\u4e2a\u865a\u62df\u6587\u4ef6\uff0c\u5b83\u63d0\u4f9b\u4e86\u4e00\u4e2a\u6709\u7528\u7684\u62a5\u544a\uff0c\u663e\u793a\u5b89\u88c5\u4e86\u591a\u5c11\u5185\u5b58\u3001\u7a7a\u95f2\u5185\u5b58\u548c\u53ef\u7528\u5185\u5b58\u3002\u663e\u7136\uff0c\u7a7a\u95f2\u548c\u53ef\u7528\u5e76\u4e0d\u662f\u4e00\u4e2a\u610f\u601d\u3002MemFree<\/code>\u4ee3\u8868\u672a\u4f7f\u7528\u7684RAM<\/code>\uff0cMemAvailable<\/code>\u662f\u5bf9\u542f\u52a8\u65b0\u5e94\u7528\u7a0b\u5e8f\u53ef\u7528\u5185\u5b58\u7684\u4f30\u8ba1\u3002<\/p>\n

\u5982\u679c\u53ea\u60f3\u67e5\u770b\u603b\u5185\u5b58\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u4e4b\u4e00\uff1a<\/strong><\/span><\/div>\n

DirectMap<\/code>\u6761\u76ee\u5c06\u5185\u5b58\u4e0a\u7684\u4fe1\u606f\u5206\u89e3\u6210\u7c7b\u522b\u3002<\/p>\n

DirectMap4k<\/code>\u8868\u793a\u6620\u5c04\u5230\u6807\u51c64k\u9875\u9762\u7684\u5185\u5b58\u91cf\uff0c\u800cDirectMap2M\u8868\u793a\u6620\u5c04\u52302MB\u9875\u9762\u7684\u5185\u5b58\u91cf\u3002<\/p>\n

getconf<\/code>\u547d\u4ee4\u5c06\u63d0\u4f9b\u7684\u4fe1\u606f\u5f80\u5f80\u6bd4\u8f83\u591a\u3002<\/p>\n

\"\"
\n\u4f7f\u7528\u5982\u4e0b\u6240\u793a\u7684\u547d\u4ee4\u53ef\u4ee5\u5c06\u8f93\u51fa\u7f29\u51cf\u4e3a\u7279\u5b9a\u7684\u5185\u5bb9\uff0c\u4f60\u80fd\u591f\u83b7\u5f97\u4e0e\u4e0a\u9762\u7684\u4e00\u4e9b\u547d\u4ee4\u76f8\u540c\u7684\u4fe1\u606f\u3002
\n\"\"
\n\u8be5\u547d\u4ee4\u901a\u8fc7\u5c06\u8f93\u51fa\u7684\u7b2c\u4e00\u884c\u548c\u6700\u540e\u4e00\u884c\u4e2d\u7684\u503c\u76f8\u4e58\u6765\u8ba1\u7b97\u5185\u5b58\uff0c\u5982\u4e0b\u6240\u793a\uff1a
\n\"\"
\n\u72ec\u7acb\u5730\u8fdb\u884c\u8ba1\u7b97\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u770b\u5230\u8fd9\u4e2a\u503c\u662f\u5982\u4f55\u63a8\u5bfc\u51fa\u6765\u7684\u3002
\n\"\"<\/p>\n

\u53e6\u4e00\u4e2a\u8f93\u51fa\u975e\u5e38\u5bb9\u6613\u7406\u89e3\u7684\u547d\u4ee4\u662ftop<\/code>\uff0ctop<\/code>\u8f93\u51fa\u524d5\u884c\u4e2d\u7684\u6570\u5b57\u663e\u793a\u4e86\u5185\u5b58\u7684\u4f7f\u7528\u60c5\u51b5\u3002<\/p>\n

\"\"<\/p>\n

\u6700\u540e\u8fd9\u4e2a\u547d\u4ee4\u5c06\u4ee5\u7b80\u6d01\u7684\u65b9\u5f0f\u56de\u7b54\u201c\u8fd9\u4e2a\u7cfb\u7edf\u4e0a\u5b89\u88c5\u4e86\u591a\u5c11RAM ?<\/p>\n

\"\"<\/p>\n

\u6839\u636e\u60a8\u5e0c\u671b\u770b\u5230\u7684\u8be6\u7ec6\u4fe1\u606f\u7684\u591a\u5c11\uff0cLinux\u7cfb\u7edf\u63d0\u4f9b\u4e86\u8bb8\u591a\u9009\u9879\uff0c\u53ef\u4ee5\u67e5\u770b\u7cfb\u7edf\u4e0a\u5b89\u88c5\u4e86\u591a\u5c11\u5185\u5b58\uff0c\u4ee5\u53ca\u4f7f\u7528\u4e86\u591a\u5c11\u5185\u5b58\u548c\u6709\u591a\u5c11\u53ef\u7528\u5185\u5b58\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u4e0d\u8fc7\uff0c\u5728\u8fdb\u4e00\u6b65\u8ba8\u8bba\u4e4b\u524d\uff0c\u6211\u4eec\u8981\u5148\u56de\u987e\u4e00\u4e9b\u57fa\u672c\u77e5\u8bc6\u3002\u7269\u7406\u5185\u5b58\u548c\u865a\u62df\u5185\u5b58\u662f\u4e0d\u4e00\u6837\u7684\uff0c\u540e\u8005\u5305\u62ec\u914d\u7f6e\u4e3a\u4ea4\u6362\u533a\u7684\u78c1\u76d8\u7a7a\u95f4 […]<\/p>\n","protected":false},"author":1893,"featured_media":137727,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-137725","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/137725","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1893"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=137725"}],"version-history":[{"count":5,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/137725\/revisions"}],"predecessor-version":[{"id":138152,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/137725\/revisions\/138152"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/137727"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=137725"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=137725"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=137725"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}