Only re-use the existing reference if it is large enough to hold all the new data. If it isn't then throw it away to avoid copying its current contents during the resize().
Only re-use the existing reference if it is large enough to hold all the new data. If it isn't then throw it away to avoid copying its current contents during the resize().