I'm pretty much stuck with a question I never got an answer for, a question which addresses an extremely important issue; memory fragmentation at boost::asio.
Found nothing at the documentation nor here at SO.
The async functions at boost::asio, for example async_write() & async_read_some() always allocate something. (in my case it's 144 & 96 bytes respectively, in VC9 Debug build).
How do I know about it?
I connect a client to the "echo server" example provided with this library.
I put a breakpoint at "new.cpp" at the code of "operator new(size_t size)".
Then I send "123". Breakpoint is hit!
Now using the stack trace I can clearly see that the root to the "new" call is coming from the async_write() & async_read_some() calls I make in the function handlers.
So memory fragmentation will come sooner or later, thus I can't use ASIO, and I wish I could!
I want to note that I understand that an async operation requires, at least at IOCP, an allocated structure to be used during the operation, until completion (when handler is called).
For example with IOCP you must have an OVERLAPPED structure for each operation (read/write).
I suspect this is the reason that I have the above small allocations, who worries me about memory fragmentation.
How do I pool these strctures then? Platform-independent of course.
Any idea? Any helpful code example? I'm sure some of you already solved this issue.