Use list to avoid the reallocation.