It will definitely be a performance issue to have allocations in any of these code paths. The only allocations it does do are the amortized resizes.