Yes. Actually, WCF uses a "buffer manager" to prevent this problem.
I have been myself developing a network service, and during profiling I found that the allocation of Byte[]
buffers was creating a bottleneck. Not only during the allocation, but also the time the processor wasted in the GC was very high. Improvements to reuse those buffers and avoid allocations yield very big performance improvements.
You can use the BufferManager
class to avoid writing your own buffer management strategy.