I have a program where I allocate multiple buffers as a part of a receive queue to receive messages from a port (UDP protocol). Currently the buffers are not contiguous, but now I am considering making them contiguous so that I can easily patch them together if need be. Is it any less reliable/fast to request 1 large block of memory as opposed to repeatedly allocating smaller blocks.
The total size I’m looking at is 1000 2KB buffers, so 2MB.
And please, don’t tell me I should use TCP; if I could I would.
By the way I’m using c++ and compiling with VS2005.
Allocating a large block is generally faster than allocating multiple small blocks. Each allocation has an overhead, so with one large allocation you pay the overhead once instead of many times.