Ok so I think everyone can agree that creating buffers on the fly in an async socket server is bad ... there is alot of literature available on the problems this will cause with the heap. I am looking at a few options to get around this.
1) Have a BufferPool class that hands out ArraySegment<byte> portions of a larger array (large enough that it would be in the LOH). If all of the array is used create another big segment. 2) Create a bunch of smaller arrays for use by the bufferpool class and have it hand them back In both 1 & 2 I would probably have the connection use their buffer for the duration of the connection. I would internally hold a list of the free blocks. When a connection was done ith its buffer it would have to release it back to this pool. My thought is that #2 might be better for dealing with cases where I want to shrink the number of buffers allocated from the previous maximum if needed. In general I lean towards #1 ... but figured I would check if I might be missing something. Thanks in advance, Greg Young =================================== This list is hosted by DevelopMentor® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com
