The program runs fine for a few minutes and then ReadFile starts failing with error code ERROR_WORKING_SET_QUOTA.
I'm using ReadFile with overlapped I/O like so:
while (continueReading)
{
BOOL bSuccess = ReadFile(deviceHandle, pReadBuf, length,
&bytesRead, readOverlappedPtr);
waitVal = WaitForMultipleObjects(
(sizeof(eventsToWaitFor)/sizeof(eventsToWaitFor[0])),
eventsToWaitFor, FALSE, INFINITE);
if (waitVal == WAIT_OBJECT_0) {
// do stuff
} else if (waitVal == WAIT_OBJECT_0 + 1) {
// do stuff
} else if (waitVal == WAIT_OBJECT_0 + 2) {
// complete the read
bSuccess = GetOverlappedResult(deviceHandle, &readOverlapped,
&bytesRead, FALSE);
if (!bSuccess) {
errorCode = GetLastError();
printf("ReadFile error=%d\n", errorCode);
}
}
}
Why am I getting this error?