{"id":242,"date":"2008-09-24T13:49:49","date_gmt":"2008-09-24T17:49:49","guid":{"rendered":"http:\/\/benjamin.smedbergs.us\/blog\/?p=242"},"modified":"2008-09-24T13:49:49","modified_gmt":"2008-09-24T17:49:49","slug":"call-for-help-boehmjemalloc","status":"publish","type":"post","link":"https:\/\/benjamin.smedbergs.us\/blog\/2008-09-24\/call-for-help-boehmjemalloc\/","title":{"rendered":"Call for Help: Boehm+jemalloc"},"content":{"rendered":"<p>At the Firefox summit we decided to change tack on XPCOMGC and try to use <a href=\"http:\/\/www.hpl.hp.com\/personal\/Hans_Boehm\/gc\/\">Boehm<\/a> instead of MMgc. Overall I think this was a really good decision. With help from Graydon, I even have some <a href=\"https:\/\/build.mozilla.org\/tryserver-builds\/2008-09-22_13:43-bsmedberg@mozilla.com-try-8a69bc11f94\/\">Linux builds<\/a> that use Boehm under the hood (most memory is not considered collectable, only string buffers are collected objects at this point).<\/p>\n<p>Unfortunately, while Boehm is a pretty good collector, it doesn&#8217;t do so well at memory allocation and fragmentation. Heap usage is between 1.5x and 2x that of standard Firefox using jemalloc. What I really want is a combination of jemalloc and Boehm, taking the best features from each:<\/p>\n<h4>Boehm Features:<\/h4>\n<ul>\n<li>Fast and threadsafe conservative collector\n<li>Smart rooting of all thread stacks and static data\n<li>Incremental marking with hardware write barriers<sup><a href=\"#f1\">1<\/a><\/sup>\n<li>Option for parallel collection<sup><a href=\"#f2\">2<\/a><\/sup>\n<li>Ability to intermingle collected and non-collected memory\n<\/ul>\n<h4>jemalloc features:<\/h4>\n<ul>\n<li>Better overall memory usage, primarily due to <a href=\"http:\/\/blog.pavlov.net\/tag\/jemalloc\/\">lower fragmentation<\/a>\n<li>Very tight and well-performing allocator\n<\/ul>\n<h2>Help Wanted<\/h2>\n<p>I&#8217;m looking for somebody who&#8217;s willing to painstakingly combine the best of these two allocators: either port the jemalloc low-fragmentation design to Boehm, or port the Boehm collection mechanism to the jemalloc allocator. If you&#8217;re interested, please contact me. Getting a solution to this problem really blocks any serious plans for further work on XPCOMGC.<\/p>\n<h2>Notes<\/h2>\n<ol>\n<li><a name=\"f1\"><\/a>The key word is <em>hardware<\/em>. The MMgc solution failed because altering our codebase to have correct programmatic write barriers was going to involve boiling the ocean. And even with smart pointers, a standard MMgc write barrier involves a lot of overhead.\n<li><a name=\"f2\"><\/a>In Boehm, parallel collection doesn&#8217;t work with most incremental collection, and so we may not actually decide to use it; avoiding large pauses with incremental collection is more important.\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>At the Firefox summit we decided to change tack on XPCOMGC and try to use Boehm instead of MMgc. Overall I think this was a really good decision. With help from Graydon, I even have some Linux builds that use Boehm under the hood (most memory is not considered collectable, only string buffers are collected [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[148,67,63],"class_list":["post-242","post","type-post","status-publish","format-standard","hentry","category-mozilla","tag-boehm","tag-jemalloc","tag-xpcomgc"],"_links":{"self":[{"href":"https:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/posts\/242","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/comments?post=242"}],"version-history":[{"count":0,"href":"https:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/posts\/242\/revisions"}],"wp:attachment":[{"href":"https:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/media?parent=242"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/categories?post=242"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/tags?post=242"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}