pike.git / src / block_allocator.c

version» Context lines:

pike.git/src/block_allocator.c:597:   #endif       //fprintf(stderr, "allocating new page. was %p\n", p);    if (a->first) {    ba_page p = a->first;    DOUBLE_SHIFT(a->first);   #ifdef BA_USE_MEMALIGN    DOUBLE_LINK(a->full, p);   #else    p->next = NULL; -  p->first = NULL; +    #endif -  +  p->first = NULL;    }       if (a->first) return;       if (a->empty_pages) {    a->first = a->empty;    SINGLE_SHIFT(a->empty);    a->empty_pages--;    a->first->next = NULL;    } else ba_alloc_page(a);
pike.git/src/block_allocator.c:630:   }      PMOD_EXPORT void ba_low_free(struct block_allocator * a, ba_page p,    ba_block_header ptr) {    // page was full    if (unlikely(!ptr->next)) {    INC(free_full);   #ifdef BA_USE_MEMALIGN    DOUBLE_UNLINK(a->full, p);   #endif + #if 1 +  if (a->first) { +  p->prev = a->first; +  p->next = a->first->next; +  a->first->next = p; +  if (p->next) p->next->prev = p; +  } else + #endif    DOUBLE_LINK(a->first, p);    } else if (!p->used) {    INC(free_empty);    if (a->empty_pages == a->max_empty_pages) {    ba_remove_page(a, p);    return;    }    DOUBLE_UNLINK(a->first, p);    SINGLE_LINK(a->empty, p);    a->empty_pages ++;