[minor] Allocate array at once instead of pushing