void free(void *ptr) { t_block *b; if (ptr == NULL) return ; b = search_ptr(ptr); if (b == NULL) return ; b = fusion_block(b); check_page(b); }
void free_exec(void *ptr) { t_block *b; t_region *r; if (!ptr) return ; if ((r = get_valid_region(ptr)) != NULL) { b = get_block(ptr); b->is_free = TRUE; if (b->prev && b->prev->is_free) b = fusion_block(b->prev); if (b->next && b->next->is_free) fusion_block(b); if (!b->next && !b->prev) { if (r->type == LARGE || (r->prev || r->next)) free_region(r); } } }