I think it's better to introduce 'capacity' or 'nb_allocated' field, and use that instead of HeapSize(). Then you can have new array length aligned in one place, with heap_realloc() that will handle initial state of items == NULL.