1 * malloc/arena.c (arena_get2): Avoid unnecessarily
2 retrieving #cpus from /proc.
3 * malloc/malloc.c (mALLOPt): Clamp arena_test based on
4 the value of arena_max.
6 diff --git a/malloc/arena.c b/malloc/arena.c
7 index cb8548b..00f1da5 100644
10 @@ -828,7 +828,7 @@ arena_get2(mstate a_tsd, size_t size)
12 if (mp_.arena_max != 0)
13 narenas_limit = mp_.arena_max;
15 + else if (narenas > mp_.arena_test)
17 int n = __get_nprocs ();
19 diff --git a/malloc/malloc.c b/malloc/malloc.c
20 index 8608083..f8d32da 100644
23 @@ -6134,6 +6134,12 @@ int mALLOPt(param_number, value) int par
28 + /* Clamp ARENA_TEST from ARENA_MAX to avoid creating too many
30 + if (mp_.arena_max > 0 && mp_.arena_max <= mp_.arena_test)
31 + mp_.arena_test = mp_.arena_max - 1;
33 (void)mutex_unlock(&av->mutex);