Do not fallback to auto arena when manual arena is requested

This commit is contained in:
Yinan Zhang 2020-05-13 14:17:54 -07:00
parent 95a59d2f72
commit e128b170a0

View File

@ -2164,6 +2164,10 @@ imalloc_no_sample(static_opts_t *sopts, dynamic_opts_t *dopts, tsd_t *tsd,
arena = NULL; arena = NULL;
} else { } else {
arena = arena_get(tsd_tsdn(tsd), dopts->arena_ind, true); arena = arena_get(tsd_tsdn(tsd), dopts->arena_ind, true);
if (unlikely(arena == NULL) &&
dopts->arena_ind >= narenas_auto) {
return NULL;
}
} }
if (unlikely(dopts->alignment != 0)) { if (unlikely(dopts->alignment != 0)) {
@ -3315,7 +3319,7 @@ do_rallocx(void *ptr, size_t size, int flags, bool is_realloc) {
if (unlikely((flags & MALLOCX_ARENA_MASK) != 0)) { if (unlikely((flags & MALLOCX_ARENA_MASK) != 0)) {
unsigned arena_ind = MALLOCX_ARENA_GET(flags); unsigned arena_ind = MALLOCX_ARENA_GET(flags);
arena = arena_get(tsd_tsdn(tsd), arena_ind, true); arena = arena_get(tsd_tsdn(tsd), arena_ind, true);
if (unlikely(arena == NULL)) { if (unlikely(arena == NULL) && arena_ind >= narenas_auto) {
goto label_oom; goto label_oom;
} }
} else { } else {