Ah ok I wasn't paying attention to that! But still. The way I load my data is exactly like this:
void State::load()
{
QList<State> history;
QFile file("data/statehistory.dat");
while (!in.atEnd())
{
in >> ba;
history << *(State*)(ba.data());
}
file.close();
}
void State::load()
{
QMutexLocker locker(&mutex);
QList<State> history;
QFile file("data/statehistory.dat");
file.open(QIODevice::ReadOnly);
QDataStream in(&file);
QByteArray ba;
while (!in.atEnd())
{
in >> ba;
history << *(State*)(ba.data());
}
file.close();
}
To copy to clipboard, switch view to plain text mode
So it appends into a QList one by one. I believe QList does not need contiguous memory for all objects inside, only for the pointers pointing to them. Is that right? There are roughly 200.000 pointers times 32 bit should be less than 1MB. Also, if I tried to allocate more contiguous space than I'm allowed to, the application should crash with a segfault or something. There is no problem with the loading. Everything still works afterwards, except that the data analyzer thread won't start.
Bookmarks