{"id":182,"date":"2012-06-05T00:03:08","date_gmt":"2012-06-04T23:03:08","guid":{"rendered":"http:\/\/blog.mozilla.org\/jseward\/?p=182"},"modified":"2012-06-05T00:03:08","modified_gmt":"2012-06-04T23:03:08","slug":"valgrind-now-supports-jemalloc-builds-directly","status":"publish","type":"post","link":"https:\/\/blog.mozilla.org\/jseward\/2012\/06\/05\/valgrind-now-supports-jemalloc-builds-directly\/","title":{"rendered":"Valgrind now supports JEMalloc builds directly"},"content":{"rendered":"<p>Following some sterling hackery by Alexander Potapenko and Philippe Waroquiers, Valgrind\/Memcheck now has direct support for JEMalloc, tcmalloc, and any other allocation library offering a malloc-style interface.<\/p>\n<p>This means you no longer need to build Firefox using &#8211;disable-jemalloc on Linux.\u00a0 You do still need &#8211;enable-valgrind, to stop V freaking out when JS GC scans the stack, but that&#8217;s no big deal.<\/p>\n<p>To use this, you need to give Valgrind the flag &#8211;soname-synonyms=somalloc=NONE.\u00a0 This tells it that the bundle of functions it needs to intercept (malloc, etc) live in the main executable instead of in libc.<\/p>\n<p>You need a Valgrind trunk build of 11 May or later (svn r12559).<\/p>\n<p>On MacOSX 10.7, all of this is irrelevant, since V appears to run a normal JEMalloc&#8217;d build\u00a0 just fine.<\/p>\n<p>On Android, the same trickery gives support for JEMalloc, but requires some extra hacks\u00a0 which are not in the repo, so you can&#8217;t use it as-is.\u00a0 I also have a bunch of code which checks for cross-DSO mismatches (eg, alloc by JEMalloc, free by libc), but that is also not committed yet.<\/p>\n<p>Other recent developments, that you might want to upgrade to a trunk svn build for:<\/p>\n<ul>\n<li>Translation chaining &#8212; improves performance noticably in some circumstances, particularly on lower end hardware and for the lighter weight tools.<\/li>\n<\/ul>\n<ul>\n<li>\u00a0AVX support &#8212; trunk now contains partial AVX instruction set support, enough to run a Firefox built with &#8220;gcc-4.7.0 -mavx -O2&#8221;. Work to give more complete support is ongoing.<\/li>\n<\/ul>\n<ul>\n<li>GDB server &#8212; this has been around for a while, but doesn&#8217;t\u00a0 seem widely known.\u00a0 Using it, you can control Valgrind with GDB, examine data when V reports errors, single step, all the usual stuff.\u00a0 To use it, start Valgrind with &#8211;vgdb-error=0 and follow the directions it prints.<\/li>\n<\/ul>\n<ul>\n<li>On MacOSX, reduced noise level when running Clang\/LLVM generated code.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Following some sterling hackery by Alexander Potapenko and Philippe Waroquiers, Valgrind\/Memcheck now has direct support for JEMalloc, tcmalloc, and any other allocation library offering a malloc-style interface. This means you no longer need to build Firefox using &#8211;disable-jemalloc on Linux.\u00a0 &hellip; <a class=\"go\" href=\"https:\/\/blog.mozilla.org\/jseward\/2012\/06\/05\/valgrind-now-supports-jemalloc-builds-directly\/\">Continue reading<\/a><\/p>\n","protected":false},"author":240,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.mozilla.org\/jseward\/wp-json\/wp\/v2\/posts\/182"}],"collection":[{"href":"https:\/\/blog.mozilla.org\/jseward\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.mozilla.org\/jseward\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/jseward\/wp-json\/wp\/v2\/users\/240"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/jseward\/wp-json\/wp\/v2\/comments?post=182"}],"version-history":[{"count":0,"href":"https:\/\/blog.mozilla.org\/jseward\/wp-json\/wp\/v2\/posts\/182\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.mozilla.org\/jseward\/wp-json\/wp\/v2\/media?parent=182"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.mozilla.org\/jseward\/wp-json\/wp\/v2\/categories?post=182"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.mozilla.org\/jseward\/wp-json\/wp\/v2\/tags?post=182"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}