Remove obsolete (incorrect) assertions.

This regression was introduced by
88fef7ceda (Refactor huge_*() calls into
arena internals.), and went undetected because of the --enable-debug
regression.
This commit is contained in:
Jason Evans 2015-02-15 20:13:28 -08:00
parent 02e5dcf39d
commit cb9b44914e
2 changed files with 24 additions and 23 deletions

View File

@ -983,7 +983,6 @@ arena_malloc(tsd_t *tsd, arena_t *arena, size_t size, bool zero,
{ {
assert(size != 0); assert(size != 0);
assert(size <= arena_maxclass);
arena = arena_choose(tsd, arena); arena = arena_choose(tsd, arena);
if (unlikely(arena == NULL)) if (unlikely(arena == NULL))
@ -1031,7 +1030,6 @@ arena_salloc(const void *ptr, bool demote)
index_t binind; index_t binind;
assert(ptr != NULL); assert(ptr != NULL);
assert(CHUNK_ADDR2BASE(ptr) != ptr);
chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr); chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr);
if (likely(chunk != ptr)) { if (likely(chunk != ptr)) {

View File

@ -2,34 +2,37 @@
#define CHUNK 0x400000 #define CHUNK 0x400000
#define MAXALIGN (((size_t)1) << 25) #define MAXALIGN (((size_t)1) << 25)
#define MAXSZ (((size_t)1) << 26)
#define NITER 4 #define NITER 4
TEST_BEGIN(test_basic) TEST_BEGIN(test_basic)
{ {
size_t nsz, rsz, sz; size_t sz;
void *p;
sz = 42; for (sz = 1; sz < MAXSZ; sz = nallocx(sz, 0) + 1) {
nsz = nallocx(sz, 0); size_t nsz, rsz;
assert_zu_ne(nsz, 0, "Unexpected nallocx() error"); void *p;
p = mallocx(sz, 0); nsz = nallocx(sz, 0);
assert_ptr_not_null(p, "Unexpected mallocx() error"); assert_zu_ne(nsz, 0, "Unexpected nallocx() error");
rsz = sallocx(p, 0); p = mallocx(sz, 0);
assert_zu_ge(rsz, sz, "Real size smaller than expected"); assert_ptr_not_null(p, "Unexpected mallocx() error");
assert_zu_eq(nsz, rsz, "nallocx()/sallocx() size mismatch"); rsz = sallocx(p, 0);
dallocx(p, 0); assert_zu_ge(rsz, sz, "Real size smaller than expected");
assert_zu_eq(nsz, rsz, "nallocx()/sallocx() size mismatch");
dallocx(p, 0);
p = mallocx(sz, 0); p = mallocx(sz, 0);
assert_ptr_not_null(p, "Unexpected mallocx() error"); assert_ptr_not_null(p, "Unexpected mallocx() error");
dallocx(p, 0); dallocx(p, 0);
nsz = nallocx(sz, MALLOCX_ZERO); nsz = nallocx(sz, MALLOCX_ZERO);
assert_zu_ne(nsz, 0, "Unexpected nallocx() error"); assert_zu_ne(nsz, 0, "Unexpected nallocx() error");
p = mallocx(sz, MALLOCX_ZERO); p = mallocx(sz, MALLOCX_ZERO);
assert_ptr_not_null(p, "Unexpected mallocx() error"); assert_ptr_not_null(p, "Unexpected mallocx() error");
rsz = sallocx(p, 0); rsz = sallocx(p, 0);
assert_zu_eq(nsz, rsz, "nallocx()/sallocx() rsize mismatch"); assert_zu_eq(nsz, rsz, "nallocx()/sallocx() rsize mismatch");
dallocx(p, 0); dallocx(p, 0);
}
} }
TEST_END TEST_END