array_realloc will grow the array for the target size like wl_insert_add, but will also shrink the array if the target size is sufficiently smaller than the current allocation.