Dynamic vs static memory allocation of buffers for network I/O and C?

The processor won't look up memory differently depending on where it is. Allocating on the stack is much faster, much less error-prone. Only use dynamic allocation if the allocation needs to be dynamic that is, you need a variable lifetime or type of an object.

Else, use static allocation.

I would not be so concerned with cache effects here. Socket I/O is slow and cache inefficient anyway because it requires system calls and data copying from the kernel buffer to the user space, there is no POSIX way to do zero-copy socket I/O (you can do that with custom hardware though). The best you can do is minimize the number of syscalls required to send and receive data through the socket.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions