Hi
Using this example i made it run on my N8 and E6 fine. As soon as a download starts of a large 100MB file, I see memory full errors pretty quickly. I have sufficent RAM (>128 MB) and sufficient disk (16GB).
Now i think the problem is the readAll() when writing it.
file->write(reply->readAll());
file->write(reply->readAll());
To copy to clipboard, switch view to plain text mode
The actual write is the problem.
This is not recommended for large files. So i created a simple buffer:
int t = b.size();
qDebug() << "sz1: " << t;
const int BUFFER_SIZE = 4096;
int s = 0;
int tw = 0;
while (s < t) {
int c = file->write(b.mid(s, BUFFER_SIZE)); // <---
qDebug() << "written: " << c;
tw += c;
s += BUFFER_SIZE;
}
QByteArray b(reply->readAll());
int t = b.size();
qDebug() << "sz1: " << t;
const int BUFFER_SIZE = 4096;
int s = 0;
int tw = 0;
while (s < t) {
int c = file->write(b.mid(s, BUFFER_SIZE)); // <---
qDebug() << "written: " << c;
tw += c;
s += BUFFER_SIZE;
}
To copy to clipboard, switch view to plain text mode
and even this does not work. Like 4K bufferred write should work? Even flushing() after the write makes the memory full come even quicker!
I really need some help here please..
thanks
Bookmarks