aboutsummaryrefslogtreecommitdiff
path: root/src/arena.c
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2015-09-09 12:17:01 -0700
committerChristopher Ferris <cferris@google.com>2015-09-14 14:42:15 -0700
commit6f50cbc975f782b7576ed699a7c2b123655d1b95 (patch)
treebf2c8c4efb382ee970a53eeba70a4cbeab37c013 /src/arena.c
parent36629d29adb4c02683a890d7590ac38ce5c29d92 (diff)
downloadjemalloc-6f50cbc975f782b7576ed699a7c2b123655d1b95.tar.gz
Regenerate files and re-add android changes.
Update to the jemalloc top of tree and regenerate all of the files using configure. Also, re-add all of small the android changes. In addition, add a new define to allow the chunk size to be changed easily. Use this define to set the chunk size to 512K for the 32 bit library, and set the chunk size to 2MB for the 64 bit library. Bug: 23633724 Change-Id: I9daef0428e6c22e56eb7b05089f9a3f6e2f86d82
Diffstat (limited to 'src/arena.c')
-rw-r--r--src/arena.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/arena.c b/src/arena.c
index 949fc5b..07d83ef 100644
--- a/src/arena.c
+++ b/src/arena.c
@@ -1207,10 +1207,13 @@ arena_lg_dirty_mult_set(arena_t *arena, ssize_t lg_dirty_mult)
void
arena_maybe_purge(arena_t *arena)
{
-
+#if defined(ANDROID_ALWAYS_PURGE)
+ size_t num_tries = 0;
+#else
/* Don't purge if the option is disabled. */
if (arena->lg_dirty_mult < 0)
return;
+#endif
/* Don't recursively purge. */
if (arena->purging)
return;
@@ -1219,6 +1222,10 @@ arena_maybe_purge(arena_t *arena)
* many dirty pages.
*/
while (true) {
+#if defined(ANDROID_ALWAYS_PURGE)
+ if (arena->ndirty == 0 || ++num_tries == 3)
+ return;
+#else
size_t threshold = (arena->nactive >> arena->lg_dirty_mult);
if (threshold < chunk_npages)
threshold = chunk_npages;
@@ -1228,6 +1235,7 @@ arena_maybe_purge(arena_t *arena)
*/
if (arena->ndirty <= threshold)
return;
+#endif
arena_purge(arena, false);
}
}