While the other answers provide a useful attempt to explain the problem, none of them answer the question or miss a point. Thanks to everyone for helping track the problem.
As Ali Mofrad noted, the error caused by the error std::bad_allocwhen the QList cannot allocate extra space in my call QList::append(MyObject*), Here, where this happens in the Qt source code:
qlist.cpp: line 62:
static int grow(int size)
{
volatile int x = qAllocMore(size * sizeof(void *), QListData::DataHeaderSize) / sizeof(void *);
return x;
}
qlist.cpp: line 231:
void **QListData::append(int n)
{
Q_ASSERT(d->ref == 1);
int e = d->end;
if (e + n > d->alloc) {
int b = d->begin;
if (b - n >= 2 * d->alloc / 3) {
} else {
realloc(grow(d->alloc + n));
}
}
d->end = e + n;
return d->array + e;
}
grow() (268,435,456) sizeof(void*) (8), QList. , 268435456 * 8 +2,147,483,648, int32 -2,147,483,648 int32, grow() . , std:: realloc() QListData::realloc(int), .
, ddriver, QList::reserve(), , QList - .
, QList 2 ^ 28-1 , , 2 ^ 31-1, .