static inline void *
mallocx(size_t size, int flags) {
UNUSED(flags);
- void *__ptr = malloc(size);
- REQUIRE(__ptr != NULL);
- return (__ptr);
+
+ return (malloc(size));
}
static inline void
UNUSED(flags);
REQUIRE(size != 0);
- void *__ptr = realloc(ptr, size);
- REQUIRE(__ptr != NULL);
-
- return (__ptr);
+ return (realloc(ptr, size));
}
#ifdef HAVE_MALLOC_SIZE
UNUSED(flags);
size_info *si = malloc(size + sizeof(*si));
- REQUIRE(si != NULL);
+ INSIST(si != NULL);
si->size = size;
ptr = &si[1];
UNUSED(flags);
si = realloc(si, size + sizeof(*si));
- REQUIRE(si != NULL);
+ INSIST(si != NULL);
si->size = size;
ptr = &si[1];
ADJUST_ZERO_ALLOCATION_SIZE(size);
ret = mallocx(size, 0);
+ INSIST(ret != NULL);
if (ISC_UNLIKELY((ctx->flags & ISC_MEMFLAG_FILL) != 0)) {
memset(ret, 0xbe, size); /* Mnemonic for "beef". */
ADJUST_ZERO_ALLOCATION_SIZE(new_size);
new_ptr = rallocx(old_ptr, new_size, 0);
+ INSIST(new_ptr != NULL);
if (ISC_UNLIKELY((ctx->flags & ISC_MEMFLAG_FILL) != 0)) {
ssize_t diff_size = new_size - old_size;
static void
mem_initialize(void) {
- malloc_conf = "xmalloc:true,background_thread:true,metadata_thp:auto,"
- "dirty_decay_ms:30000,muzzy_decay_ms:30000";
-
isc_mutex_init(&contextslock);
ISC_LIST_INIT(contexts);
totallost = 0;
REQUIRE(ctxp != NULL && *ctxp == NULL);
ctx = mallocx(sizeof(*ctx), 0);
+ INSIST(ctx != NULL);
*ctx = (isc_mem_t){
.magic = MEM_MAGIC,
ctx->debuglist =
mallocx((DEBUG_TABLE_COUNT * sizeof(debuglist_t)), 0);
+ INSIST(ctx->debuglist != NULL);
+
for (i = 0; i < DEBUG_TABLE_COUNT; i++) {
ISC_LIST_INIT(ctx->debuglist[i]);
}