Skip to content
AllocatorUnbind

AllocatorUnbind

Description

Release allocator runtime state bound to an object. This does not free allocations owned by containers; it only tears down the allocator’s internal state object and resets state to NULL.

Parameters

Name Direction Description
alloc in,out Allocator to unbind

Success

Function cannot fail.

Failure

No action is taken when alloc is NULL.

Usage example (Cross-references)

Usage examples (Cross-references)
    }
    
    void AllocatorUnbind(Allocator *alloc) {
        if (!alloc) {
            return;
        graph->mutation_epoch       = 0;
        graph->alignment            = 0;
        AllocatorUnbind(&graph->allocator);
        graph->allocator   = AllocatorBind(DefaultAllocator());
        graph->type_anchor = NULL;
        vec->length   = 0;
        vec->capacity = 0;
        AllocatorUnbind(&vec->allocator);
        vec->allocator = AllocatorBind(DefaultAllocator());
    }
        list->copy_deinit = NULL;
        list->length      = 0;
        AllocatorUnbind(&list->allocator);
        list->allocator = AllocatorBind(DefaultAllocator());
    }
        bitvec->capacity  = 0;
        bitvec->byte_size = 0;
        AllocatorUnbind(&bitvec->allocator);
        bitvec->allocator = AllocatorBind(DefaultAllocator());
    }
            AllocatorFree(&scratch, prev_row, (len2 + 1) * sizeof(u64), _Alignof(u64));
            AllocatorFree(&scratch, curr_row, (len2 + 1) * sizeof(u64), _Alignof(u64));
            AllocatorUnbind(&scratch);
            return false;
        }
        AllocatorFree(&scratch, prev_row, (len2 + 1) * sizeof(u64), _Alignof(u64));
        AllocatorFree(&scratch, curr_row, (len2 + 1) * sizeof(u64), _Alignof(u64));
        AllocatorUnbind(&scratch);
    
        return true;
        AllocatorFree(&map->allocator, map->entries, map->capacity * entry_size, map_storage_alignment());
        AllocatorFree(&map->allocator, map->states, map->capacity * sizeof(u8), map_storage_alignment());
        AllocatorUnbind(&map->allocator);
    
        map->entries                = NULL;
Last updated on