Thank you for you suggestion. SocketAsyncResult has Dispose method in it's implementation, but how could I call Dispose on SocketAsyncResult if this class is internal? BeginSend returns IAsyncResult interface, which does not have Dispose in the interface definition.
I found some old posts in the internet about similar issue with OverlappedAsyncResult (internal implementation of IAsyncResult in BeginSend in .NET). They told, that in .NET 1.1 there was a memory leak in similar scenarious, because buffer was pinned and memory could not be defragmented by GC. Also, they told, that in .NET 2.0 such issue was fixed. They recommended to pool buffers to prevent reallocating them in memory. I followed this advice and removed creation of SendStateObject from the Send function. Creation SendStateObject only one time per each client in class constructor helped me to minimize memory leaks, so they now not so huge, but still present. -- View this message in context: http://mono.1490590.n4.nabble.com/Async-sockets-and-memory-leaks-in-BeginSend-tp4648844p4649533.html Sent from the Mono - General mailing list archive at Nabble.com. _______________________________________________ Mono-list maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-list
