QDataStream memory overflow [solved]
-
Hi everybody,
I have a problem in my database when I import some data.
After checking my writting function which use datastream I found something that makes me think the problem is about memory overflow of my datastream.
Here is my code:
@QDataStream out(&file);
out.setVersion(QDataStream::Qt_5_2);
out << _missionsEx.size();
for(int i=0; i<_missionsEx.size() ;i++)
{
out << _missionsEx[i];for(int j=0; j< _missionsEx[i]._porte[0]._cylindre.size() ;j++) for(int k=0; k< _missionsEx[i]._porte[0]._cylindre[j]._axe.first()._aquisition.size() ;k++) { if(_missionsEx[i]._porte[0]._cylindre[j]._axe.first()._aquisition[k]._bscan.isNull()) qDebug()<< "NULL" <<_missionsEx[i]._porte[0]._cylindre[j]._axe.first()._aquisition[k]._id; }
}@
My class MissionBDD is pretty big it contains several classes and the class Aquisition contains several images (_bscan) (about 2,5 Mo).
If I try to write mission which contains 150 images.
I have 53 images which are really written the others are "White".Someone can help me to fix this problem ?
Thanks -
Hi,
Pretty strange⦠You could try flushing the QDataStream in between two _missionsEx.
Also, are you sure that everything is generated correctly ?
-
Sorry, it's in QTextStream.
One thing you could do is check the status of the stream between two writes
-
-
32bit application ?
-
I wonder if you're not hitting the 2GB memory limit somehow, but that should rather kill your application AFAIK.
-
AFAIK, it should not.
However I wonder what might happen if you are reaching the limit of available memory without allocating enough to make the OS decide to kill your application.
-
It's because your application is 32bit, the max memory size it can use is 2GB even if you computer had terabytes available