Bug 1110514 - Use arena.<i>.purge to free jemalloc3's dirty pages. r=glandium
authorGuilherme Goncalves <guilherme.p.gonc@gmail.com>
Tue, 23 Dec 2014 02:41:00 -0500
changeset 238125 866eedaf819c745d9a38a8bd96046e17377931e8
parent 238124 e85722c30be37b7eddec9485707546a5c13020e3
child 238126 b1b9af321bac85386bac98a3b7f17c1e70ad3c83
push id7472
push userraliiev@mozilla.com
push dateMon, 12 Jan 2015 20:36:27 +0000
treeherdermozilla-aurora@300ca104f8fb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1110514
milestone37.0a1
Bug 1110514 - Use arena.<i>.purge to free jemalloc3's dirty pages. r=glandium
memory/build/mozjemalloc_compat.c
--- a/memory/build/mozjemalloc_compat.c
+++ b/memory/build/mozjemalloc_compat.c
@@ -172,10 +172,17 @@ jemalloc_stats_impl(jemalloc_stats_t *st
 MOZ_JEMALLOC_API void
 jemalloc_purge_freed_pages_impl()
 {
 }
 
 MOZ_JEMALLOC_API void
 jemalloc_free_dirty_pages_impl()
 {
-  je_(mallctl)("arenas.purge", NULL, 0, NULL, 0);
+  unsigned narenas;
+  size_t mib[3];
+  size_t miblen = sizeof(mib) / sizeof(mib[0]);
+
+  CTL_GET("arenas.narenas", narenas);
+  je_(mallctlnametomib)("arena.0.purge", mib, &miblen);
+  mib[1] = narenas;
+  je_(mallctlbymib)(mib, miblen, NULL, NULL, NULL, 0);
 }