{"id":2316,"date":"2018-11-29T16:01:12","date_gmt":"2018-11-29T08:01:12","guid":{"rendered":"https:\/\/damogame.cn:15443\/wordpress\/?p=2316"},"modified":"2018-12-06T11:58:56","modified_gmt":"2018-12-06T03:58:56","slug":"jemalloc%e5%9c%a8linux%e4%b8%8a%e4%bb%8e%e5%ae%89%e8%a3%85%e5%88%b0%e4%bd%bf%e7%94%a8","status":"publish","type":"post","link":"https:\/\/i007.cc\/wordpress\/archives\/2316","title":{"rendered":"jemalloc\u5728linux\u4e0a\u4ece\u5b89\u88c5\u5230\u4f7f\u7528"},"content":{"rendered":"<div class=\"article-header-box\">\n<div class=\"article-header\">\n<div class=\"article-title-box\"><\/div>\n<\/div>\n<\/div>\n<article class=\"baidu_pl\">\n<div id=\"article_content\" class=\"article_content clearfix csdn-tracking-statistics\" data-pid=\"blog\" data-mod=\"popu_307\" data-dsm=\"post\">\n<div class=\"article-copyright\">jemalloc\u5728linux\u4e0a\u4ece\u5b89\u88c5\u5230\u4f7f\u7528<\/div>\n<div id=\"content_views\" class=\"markdown_views prism-atom-one-dark\">\n<p>\u4e0a\u6b21\u5728\u5f15\u5bfc\u5927\u5bb6\u5b89\u88c5redis\u65f6\u63d0\u5230\u53ef\u80fd\u4f1a\u62a5\u9519\uff1a<br \/>\n<img decoding=\"async\" title=\"\" src=\"https:\/\/img-blog.csdn.net\/20160815205211863\" alt=\"jemlloc\u5e93\u7f3a\u5931\" \/><\/p>\n<p>\u53d1\u73b0\u4e86redis\u6709\u7528\u5230jemalloc\u3002<\/p>\n<p>\u9996\u5148\uff0cjemalloc\u662f\u5e72\u4ec0\u4e48\u7684\uff1f<br \/>\n\u6211\u4eec\u770b\u770b\u4f5c\u8005\u81ea\u5df1\u7684\u4ecb\u7ecd\uff1a<\/p>\n<p>jemalloc is a general purpose malloc(3) implementation that emphasizes fragmentation avoidance and scalable concurrency support<\/p>\n<p>\u610f\u601d\u662f\u8bf4jemalloc\u5e72\u4e86malloc\u5e72\u7684\u6d3b\uff0c\u800c\u4e14\u5e72\u5f97\u597d\u4e00\u4e9b\uff0c\u4e3b\u8981\u4f53\u73b0\u5728\u907f\u514d\u5185\u5b58\u788e\u7247\u4e0e\u5e76\u53d1\u6269\u5c55\u4e0a\u3002<\/p>\n<p>\u9996\u5148\uff0c\u4ec0\u4e48\u662f\u5185\u5b58\u788e\u7247\uff1f<\/p>\n<p>\u5047\u8bbe\u7cfb\u7edf\u53ea\u6709\u4e00\u724764\u5b57\u8282\u7684\u5185\u5b58\uff0c\u5206\u914d\u7ed94\u4e2a\u5355\u5143\uff0c\u6bcf\u4e2a16\u4e2a\u5b57\u8282\uff1a<br \/>\n<img decoding=\"async\" title=\"\" src=\"https:\/\/img-blog.csdn.net\/20160815222710052\" alt=\"\u8fd9\u91cc\u5199\u56fe\u7247\u63cf\u8ff0\" \/><br \/>\n\u5c06\u8fd94\u4e2a\u5355\u5143\u5206\u914d\u91ca\u653e\u518d\u91cd\u65b0\u5206\u914d4\u4e2a12\u5b57\u8282\u7684\u5185\u5b58\u7247\uff1a<br \/>\n<img decoding=\"async\" title=\"\" src=\"https:\/\/img-blog.csdn.net\/20160815222752413\" alt=\"\u8fd9\u91cc\u5199\u56fe\u7247\u63cf\u8ff0\" \/><br \/>\n\u6211\u4eec\u53d1\u73b0\u591a\u4e864*4\u4e0d\u8fde\u7eed\u7684\u5185\u5b58\u7247\uff0c\u4e0b\u6b21\u6211\u4eec\u5c31\u4e0d\u80fd\u5206\u914d12\u6216\u800516\u5b57\u8282\u7684\u5185\u5b58\u4e86\u3002<br \/>\n\u53e6\u5916\uff0cglibc\u5206\u914d\u5185\u5b58\u4e00\u822c\u54114\u6216\u80058\u53d6\u6574\uff0c\u6bd4\u5982\u6211\u4eec\u5411\u7533\u8bf713\u5b57\u8282\u7684\u5185\u5b58\uff0c\u5b9e\u9645\u4e0a\u5f97\u5230\u7684\u5185\u5b58\u7247\u4f1a\u662f16\u5b57\u8282\uff0c\u591a\u51fa\u6765\u76843\u4e2a\u5b57\u8282\u6211\u4eec\u4e0d\u77e5\u9053\uff0c\u4e5f\u5c31\u65e0\u6cd5\u4f7f\u7528\u4e86\u3002<\/p>\n<p>\u5185\u5b58\u788e\u7247\u5f88\u53ef\u6015\u5417\uff1f<br \/>\n\u77ed\u65f6\u95f4\u5185\u4e0d\u660e\u663e\uff0c\u5bf9\u4e8e\u7ebf\u4e0a\u7684\u670d\u52a1\u5668\u6bd4\u5982nginx,\u8fd0\u884c\u65f6\u95f4\u53ef\u80fd\u7ecf\u5e74\uff0c\u6bcf\u5929\u51e0\u4ebf\u7684\u8bf7\u6c42\u91cf\uff0c\u5982\u679c\u6bcf\u5929\u4ea7\u751f100\u7247 \uff0c\u4e00\u5e74\u4e0b\u6765\u4e5f\u662f3\u4e07\u591a\u7247 \uff0c\u76f8\u5f53\u6050\u6016\uff01<\/p>\n<p>jemalloc\u53ef\u4ee5\u6709\u6548\u7684\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff01<br \/>\njemalloc\u7684\u6027\u80fd\u56fe\uff08\u4e0a\u7bc7\u5df2\u7ecf\u5c55\u793a\u8fc7\uff09\uff1a<br \/>\n<img decoding=\"async\" title=\"\" src=\"https:\/\/img-blog.csdn.net\/20160815224543219\" alt=\"\u8fd9\u91cc\u5199\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u65e2\u7136jemalloc\u8fd9\u4e48\u725b\u903c\uff0c\u6211\u4eec\u5c31\u6765\u5b89\u88c5\u5427\uff01<\/p>\n<p>\u5148github\u4e0a\u4e0b\u8f7d\uff1a<br \/>\n<a href=\"https:\/\/github.com\/jemalloc\/jemalloc\/releases\" target=\"_blank\" rel=\"nofollow noopener\">https:\/\/github.com\/jemalloc\/jemalloc\/releases<\/a><\/p>\n<p>\u4e0b\u8f7d\u5305\u5730\u5740\uff1a<br \/>\n<a href=\"https:\/\/github.com\/jemalloc\/jemalloc\/releases\/download\/4.2.1\/jemalloc-4.2.1.tar.bz2\" target=\"_blank\" rel=\"nofollow noopener\">jemalloc-4.2.1<\/a><\/p>\n<p>\u4e0b\u8f7d\u5230linux\u76ee\u5f55\u4e0b\u89e3\u538b\uff1a<\/p>\n<p>tar -xjvf jemalloc-4.2.1.tar.bz2<br \/>\n\u751f\u6210\u7684\u6587\u4ef6\u5217\u8868\u5982\u4e0b\uff1a<br \/>\n<img decoding=\"async\" title=\"\" src=\"https:\/\/img-blog.csdn.net\/20160815223654973\" alt=\"\u8fd9\u91cc\u5199\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u5728\u6b64\u76ee\u5f55\u4e0b\u9884\u7f16\u8bd1<\/p>\n<p>.\/configure \u2013prefix=\/usr\/local\/jemalloc<\/p>\n<p>\u5b8c\u6210\u540e\u518d\u7f16\u8bd1\uff1a<\/p>\n<p>make -j8 &amp;&amp; make install<\/p>\n<p>\u6211\u4eec\u5230\u751f\u6210\u76ee\u5f55\u53bb\u770b\u770b\uff1a<\/p>\n<p><img decoding=\"async\" title=\"\" src=\"https:\/\/img-blog.csdn.net\/20160815224004369\" alt=\"\u8fd9\u91cc\u5199\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u751f\u6210\u7684\u5934\u6587\u4ef6\u5728include\u91cc\uff0c\u5e93\u5728lib\u91cc\u3002<\/p>\n<p>\u81f3\u6b64\uff0c\u5b89\u88c5\u7b97\u662f\u5b8c\u6210\u4e86\u3002<\/p>\n<p>\u4e0b\u9762\u770b\u770b\u5982\u4f55\u4f7f\u7528\uff1a<br \/>\n\u5728\u7f16\u8bd1\u94fe\u63a5\u65f6\u76f4\u63a5\u6307\u5411jemalloc\u5373\u53ef\uff1a<\/p>\n<p>gcc -g -c -o 1.o 1.c<br \/>\ngcc -g -o 1.out 1.o -L\/usr\/local\/jemalloc\/lib -ljemalloc<\/p>\n<p>\u8fd0\u884c\u7a0b\u5e8f\u65f6\u53ef\u80fd\u4f1a\u62a5\u627e\u4e0d\u5230\u5e93\uff1a<br \/>\n<img decoding=\"async\" title=\"\" src=\"https:\/\/img-blog.csdn.net\/20160815232338768\" alt=\"\u8fd9\u91cc\u5199\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u53ea\u8981\u5c06jemalloc\u7684\u5e93\u88ab\u7cfb\u7edf\u627e\u5230\u5373\u53ef\uff1a<\/p>\n<p>echo \/usr\/local\/jemalloc\/lib &gt;&gt; \/etc\/ld.so.conf<br \/>\nldconfig<\/p>\n<p>\u518d\u6b21\u8fd0\u884c\u5373\u53ef<\/p>\n<\/div>\n<\/div>\n<\/article>\n","protected":false},"excerpt":{"rendered":"<p>jemalloc\u5728linux\u4e0a\u4ece\u5b89\u88c5\u5230\u4f7f<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"colormag_page_container_layout":"default_layout","colormag_page_sidebar_layout":"default_layout","footnotes":""},"categories":[],"tags":[117],"class_list":["post-2316","post","type-post","status-publish","format-standard","hentry","tag-01-linux"],"_links":{"self":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts\/2316","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/comments?post=2316"}],"version-history":[{"count":0,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts\/2316\/revisions"}],"wp:attachment":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/media?parent=2316"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/categories?post=2316"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/tags?post=2316"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}