Buffer optimization. Remove unnecessary allocations.