Boost logo

Boost Users :

From: Christopher Kohlhoff (chris_at_[hidden])
Date: 2006-10-30 06:48:00


Hi Christian,

Christian Henning wrote:
> Hi Christopher, thanks for putting so much time into this
> issue. I changed the code as you requested, namely I added a
> new members to my connection class.

I found another similar problem in image_source::do_write().
I've just implemented a feature for the next version that uses
MSVC's iterator debugging to check the buffer validity. These
program bugs show up as an assertion failure when this new
"buffer debugging" feature is enabled.

> But unfortunately nothing has changed. I still have memory
> leaks reported. Did you do the change on your machine?

I have now, and I found what I think is the cause of the leak.
Can you please try the following change to
asio/detail/win_iocp_io_service.hpp:

@@ -74,10 +74,11 @@
       DWORD_PTR completion_key = 0;
 #endif
       LPOVERLAPPED overlapped = 0;
- ::GetQueuedCompletionStatus(iocp_.handle,
+ ::SetLastError(0);
+ BOOL ok = ::GetQueuedCompletionStatus(iocp_.handle,
           &bytes_transferred, &completion_key, &overlapped, 0);
       DWORD last_error = ::GetLastError();
- if (last_error == WAIT_TIMEOUT)
+ if (!ok && overlapped == 0 && last_error == WAIT_TIMEOUT)
         break;
       if (overlapped)
         static_cast<operation*>(overlapped)->destroy();

Cheers,
Chris


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net