Fix arena_reset() test to avoid tcache.
This commit is contained in:
parent
259f8ebbfc
commit
2fe64d237c
@ -84,6 +84,7 @@ TEST_BEGIN(test_arena_reset)
|
|||||||
unsigned arena_ind, nsmall, nlarge, nhuge, nptrs, i;
|
unsigned arena_ind, nsmall, nlarge, nhuge, nptrs, i;
|
||||||
size_t sz, miblen;
|
size_t sz, miblen;
|
||||||
void **ptrs;
|
void **ptrs;
|
||||||
|
int flags;
|
||||||
size_t mib[3];
|
size_t mib[3];
|
||||||
tsd_t *tsd;
|
tsd_t *tsd;
|
||||||
|
|
||||||
@ -94,6 +95,8 @@ TEST_BEGIN(test_arena_reset)
|
|||||||
assert_d_eq(mallctl("arenas.extend", &arena_ind, &sz, NULL, 0), 0,
|
assert_d_eq(mallctl("arenas.extend", &arena_ind, &sz, NULL, 0), 0,
|
||||||
"Unexpected mallctl() failure");
|
"Unexpected mallctl() failure");
|
||||||
|
|
||||||
|
flags = MALLOCX_ARENA(arena_ind) | MALLOCX_TCACHE_NONE;
|
||||||
|
|
||||||
nsmall = get_nsmall();
|
nsmall = get_nsmall();
|
||||||
nlarge = get_nlarge();
|
nlarge = get_nlarge();
|
||||||
nhuge = get_nhuge() > NHUGE ? NHUGE : get_nhuge();
|
nhuge = get_nhuge() > NHUGE ? NHUGE : get_nhuge();
|
||||||
@ -104,25 +107,21 @@ TEST_BEGIN(test_arena_reset)
|
|||||||
/* Allocate objects with a wide range of sizes. */
|
/* Allocate objects with a wide range of sizes. */
|
||||||
for (i = 0; i < nsmall; i++) {
|
for (i = 0; i < nsmall; i++) {
|
||||||
sz = get_small_size(i);
|
sz = get_small_size(i);
|
||||||
ptrs[i] = mallocx(sz, MALLOCX_ARENA(arena_ind));
|
ptrs[i] = mallocx(sz, flags);
|
||||||
assert_ptr_not_null(ptrs[i],
|
assert_ptr_not_null(ptrs[i],
|
||||||
"Unexpected mallocx(%zu, MALLOCX_ARENA(%u)) failure", sz,
|
"Unexpected mallocx(%zu, %#x) failure", sz, flags);
|
||||||
arena_ind);
|
|
||||||
}
|
}
|
||||||
for (i = 0; i < nlarge; i++) {
|
for (i = 0; i < nlarge; i++) {
|
||||||
sz = get_large_size(i);
|
sz = get_large_size(i);
|
||||||
ptrs[nsmall + i] = mallocx(sz, MALLOCX_ARENA(arena_ind));
|
ptrs[nsmall + i] = mallocx(sz, flags);
|
||||||
assert_ptr_not_null(ptrs[i],
|
assert_ptr_not_null(ptrs[i],
|
||||||
"Unexpected mallocx(%zu, MALLOCX_ARENA(%u)) failure", sz,
|
"Unexpected mallocx(%zu, %#x) failure", sz, flags);
|
||||||
arena_ind);
|
|
||||||
}
|
}
|
||||||
for (i = 0; i < nhuge; i++) {
|
for (i = 0; i < nhuge; i++) {
|
||||||
sz = get_huge_size(i);
|
sz = get_huge_size(i);
|
||||||
ptrs[nsmall + nlarge + i] = mallocx(sz,
|
ptrs[nsmall + nlarge + i] = mallocx(sz, flags);
|
||||||
MALLOCX_ARENA(arena_ind));
|
|
||||||
assert_ptr_not_null(ptrs[i],
|
assert_ptr_not_null(ptrs[i],
|
||||||
"Unexpected mallocx(%zu, MALLOCX_ARENA(%u)) failure", sz,
|
"Unexpected mallocx(%zu, %#x) failure", sz, flags);
|
||||||
arena_ind);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tsd = tsd_fetch();
|
tsd = tsd_fetch();
|
||||||
|
Loading…
Reference in New Issue
Block a user