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 -
Someone can help me ?
-
Hi,
Pretty strangeā¦ You could try flushing the QDataStream in between two _missionsEx.
Also, are you sure that everything is generated correctly ?
-
Everything is generated correctly i'm sure because I work with this data.
I'd like try a "flush" between missions but there is no function flush or something like that in QDataStream.thk for your reply.
-
Sorry, it's in QTextStream.
One thing you could do is check the status of the stream between two writes
-
The status is everytime ok.
All "missions" are done in the loop but I think the size of data is to big.
about 1,6 Go in RAM.
There is no error in writing, it's when I want import these data that the reader write first data (about 50 -55 missions). -
32bit application ?
-
Yes I would like to do in 64 but i used a library in 32.
-
I wonder if you're not hitting the 2GB memory limit somehow, but that should rather kill your application AFAIK.
-
But writing or reading files with more then 2 GB should not hurt unless you allocate everything in memory, shouldn't it?
-
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.
-
What about: try it out? :D
-
Hi Thanks for your reply,
For information, I think the OS block the use of memory at about 2Go.
I have a lot of memory (64Go). But my application use 1.6Go at maximum. -
It's because your application is 32bit, the max memory size it can use is 2GB even if you computer had terabytes available