Total size of allocated memory by container
Is there any way how to know the total amount of memory allocated by containers like QList? I wish I had an option to be able to have information about, just to compute how many things I can stick into some memory limit. I can closely estimate memory usage for basic containers like QList (which seems to be double-linked list) or QVector, but not the other containers.
In general no. QList is not really a linked list (QLinkedList is). It is a sorta vector-list hybrid that allocates chunks of the data as contiguous arrays. How many chunks there are, what is their overhead size, does it hold pointers to elements or optimizes small sized items by holding them in place, what is the alignment overhead - these are all implementation details that affect the size and there's no reliable way to estimate them, or even if you did, they might change in future versions.