Solved How much memory to allow for a 30 character string?
-
I see that sizeof returns 8 for a QString:
QString s; s = "012345678901234567890123456789"; qDebug() << sizeof(s);
How much more memory is taken up by the characters, is it 1 byte per character?
-
Hi,
sizeof return the size of an object:
qDebug() << sizeof(QString); // -> 8
A QString is composed of 16 bits unicode characters.
Hence the size in memory is equal to:2*s.size() or sizeof(QChar)*s.size();
-
Hi,
@Guerrian out of curiosity, are you only interested in the space taken by the chars or the complete data structure that is QString ?