shrink pre allocated bytes array when there is no enough data