pike.git / src / block_allocator.c

version» Context lines:

pike.git/src/block_allocator.c:67:    PIKE_MEMPOOL_ALLOC(a, p->h.first, l->block_size);    p->h.first->next = BA_ONE;    PIKE_MEMPOOL_FREE(a, p->h.first, l->block_size);   }      static struct ba_page * ba_alloc_page(struct block_allocator * a, int i) {    struct ba_layout l = ba_get_layout(a, i);    size_t n = l.offset + l.block_size + l.doffset;    struct ba_page * p;    if (l.alignment) { -  p = (struct ba_page*)aligned_alloc(n, l.alignment); +  p = aligned_alloc(n, l.alignment);    } else {   #ifdef DEBUG_MALLOC    /* In debug malloc mode, calling xalloc from the block alloc may result    * in a deadlock, since xalloc will call ba_alloc, which in turn may call xalloc.    */ -  p = (struct ba_page*)system_malloc(n); +  p = system_malloc(n);    if (!p) {    fprintf(stderr, "Fatal: Out of memory.\n");    exit(17);    }   #else -  p = (struct ba_page*)xalloc(n); +  p = xalloc(n);   #endif    }    ba_clear_page(a, p, &a->l);    PIKE_MEM_NA_RANGE((char*)p + l.doffset, n - l.doffset);    return p;   }      static void ba_free_empty_pages(struct block_allocator * a) {    int i = a->size - 1;