aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2019-03-18 15:26:51 -0700
committerChristopher Ferris <cferris@google.com>2019-03-18 15:32:49 -0700
commitcc374363ecc5b8991cac2c9d0e45a95f9a233c74 (patch)
tree9f328f5516c84a141bbe2eb407bec8743863350f /src
parent347192e6aab661ceb66dfdeef2924a86a4d8c7b7 (diff)
downloadplatform_external_jemalloc_new-cc374363ecc5b8991cac2c9d0e45a95f9a233c74.tar.gz
platform_external_jemalloc_new-cc374363ecc5b8991cac2c9d0e45a95f9a233c74.tar.bz2
platform_external_jemalloc_new-cc374363ecc5b8991cac2c9d0e45a95f9a233c74.zip
Remove best fit for extent selection.
A jemalloc user reported that the best fit selection is causing them a memory leak. This code has been completely removed from the next release of jemalloc (5.2.0), so remove it since it doesn't have any real benefit. See https://github.com/jemalloc/jemalloc/issues/1454 Running the memory dumps, removing best fit appears to be a win: it is slightly faster and has the same PSS/VA. Bug: 128697497 Test: Ran jemalloc unit tests. Test: Ran memory dumps in 32 bit and 64 bit and observed that the PSS Test: and VA stayed the same, while run time improved slightly. Change-Id: I98a8ddf2cea837c8ade1afd4a998960c253d3932
Diffstat (limited to 'src')
-rw-r--r--src/extent.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/extent.c b/src/extent.c
index 09d6d771..da66a8e0 100644
--- a/src/extent.c
+++ b/src/extent.c
@@ -394,6 +394,12 @@ extents_fit_alignment(extents_t *extents, size_t min_size, size_t max_size,
return NULL;
}
+// ANDROID
+// The best-fit selection is reported to possiblity cause a memory leak.
+// This code has been completely removed from 5.2.0, so remove it from
+// our tree rather than risk a leak.
+// See https://github.com/jemalloc/jemalloc/issues/1454
+#if 0
/* Do any-best-fit extent selection, i.e. select any extent that best fits. */
static extent_t *
extents_best_fit_locked(tsdn_t *tsdn, arena_t *arena, extents_t *extents,
@@ -417,6 +423,7 @@ extents_best_fit_locked(tsdn_t *tsdn, arena_t *arena, extents_t *extents,
return NULL;
}
+#endif
/*
* Do first-fit extent selection, i.e. select the oldest/lowest extent that is
@@ -464,9 +471,18 @@ extents_fit_locked(tsdn_t *tsdn, arena_t *arena, extents_t *extents,
return NULL;
}
+// ANDROID
+// The best-fit selection is reported to possiblity cause a memory leak.
+// This code has been completely removed from 5.2.0, so remove it from
+// our tree rather than risk a leak.
+// See https://github.com/jemalloc/jemalloc/issues/1454
+#if 0
extent_t *extent = extents->delay_coalesce ?
extents_best_fit_locked(tsdn, arena, extents, max_size) :
extents_first_fit_locked(tsdn, arena, extents, max_size);
+#endif
+ extent_t *extent =
+ extents_first_fit_locked(tsdn, arena, extents, max_size);
if (alignment > PAGE && extent == NULL) {
/*