QFile::read failing on XP SP3
I am trying to read a 131MB file on windows XP into a buffer I allocated and I am getting the following error.
"Insufficient system resources exist to complete the requested service."
I see in the Qt4.4 source code that the reads are limited to 32MB to try to avoid this problem however I am still hitting it when the source is a network drive. I guess I could ask for even smaller chunks but I need the read to be reliable.
Ideas? Solutions / workarounds?
Re: QFile::read failing on XP SP3
I made my max read size at 1 MB but this makes me nervous.
Re: QFile::read failing on XP SP3
That's a Windows error, not a Qt one (QFile::read just uses winapi).
http://support.microsoft.com/kb/913872
Re: QFile::read failing on XP SP3
I expected as much. Especially that it was not fixed in 3 years!
Looks like I will be extending the QFile class to deal with this..
Specifically I will override
QIODevice::readData
with my own function to workaround the windows bug..
BTW, this does not seem to happen on writes since Qt happily created the 131MB file in one call to QIODevice::write(buff,size);
Re: QFile::read failing on XP SP3
That's not gonna do it. The workaround suggested you use FILE_FLAG_NO_BUFFERING when you open the file (with CreateFile).
You can then use ReadFile to read data.
Not really necessary to subclass QIODevice, unless you're building the app for other platforms than win.
Re: QFile::read failing on XP SP3
Quote:
Originally Posted by
marcel
Not really necessary to subclass QIODevice, unless you're building the app for other platforms than win.
I am building the application for linux and windows and in the future Macintosh. With my build system I can easily have any kludges compiled in or out depending on the system.
Re: QFile::read failing on XP SP3
Quote:
Originally Posted by
marcel
That's not gonna do it. The workaround suggested you use
FILE_FLAG_NO_BUFFERING when you open the file (with
CreateFile).
You can then use
ReadFile to read data.
I know. I am going to look into the ramifications of doing that before I make it permanent.
Re: QFile::read failing on XP SP3
BTW,
The windows version of the same code is failing in the _read() in the same way on the same input file as expected..