Memory strategy when using IOCP

I am new to Windows IOCP, I am currently rewriting the network part of our server with IOCP. I'm trying to figure out how to handle memory (Overlapped / WSABUF objects). I have a small structure that comes from OVERLAPPED and contains WSABUF and a few other fields.

I tried to save a ring buffer for these objects and reuse them, but it didn't work. I thought that when the completion routine was called, one of the objects would be passed back to me and I could mark it as available again.

When I allocate them on the heap (and store them in a vector), how can I know when it is safe to delete / reuse it?

Thanks Michael

+3


source to share





All Articles