It seems that providing a buffer large enough for the data I expect to deal with is the most reliable approach.