Checking size of QByteArray always returns 4 bytes, I'm assuming due to implicit sharing of data in Qt:
int n = 50; //or n = 100, 200
QByteArray arr(n,'a');
cout << sizeof(arr) << endl;
::getchar();
Always prints 4
How can I estimate the actual memory footprint of QByteArray? The question is motivated by efficiently storing large number of 5 byte identifiers - they can either be stored each as quint64 (using 8 bytes for each, 3 bytes are therefore wasted), or as each as QByteArray - but I'm not sure how to estimate overhead in the latter case....
I would like to use these identifiers as key for QMap, so they should each be in their own structure - one long QByteArray won't work...