PDA

View Full Version : The maximum size of a QList



Denarius
28th April 2009, 09:05
Hello,
I've got a question,
What is the maximum size of a QList?

Is it of type integer? Because the iterators and access features are all integer based.
If so, What is the maximum size of the list? (Which integer type is actually used?)
Is it system dependent or (int32, int64 etc.) or is it a defined integer?

If I try to put in more objects than the maximum size of the QList?
What happens then?

I've read the Qt Reference but it doesn't say what will happen in these instances.

wysota
28th April 2009, 13:14
What is the maximum size of a QList?
It's limited only by the memory.


Is it of type integer?
What is the return type of QList::count()?


Because the iterators and access features are all integer based.
Then you have your answer.


If so, What is the maximum size of the list? (Which integer type is actually used?)
Is it system dependent or (int32, int64 etc.) or is it a defined integer?
If it says "int" then this means "int" which is a C type that can differ between architectures, if it says "int32" then it means "32 bit signed integer value" which mean 2^31.


If I try to put in more objects than the maximum size of the QList?
What happens then?
You will most likely kill your application or render it useless. I can't imagine a usecase where you'd need 2G different values and you would store them in a linear list. Traversing such a list would take ages.

SiL3NC3
30th November 2012, 10:22
hi,
a short note:
i encountered a problem using QList<QString> var; for a list with filenames.
at an amount of 20000 files the processing slowed downed this much, that it seems to be a delay function "sleeping" for milliseconds.
maybe this is also part of the discussion about "how much entries could a QList object have?" ...

//SiL

wysota
30th November 2012, 10:27
hi,
a short note:
i encountered a problem using QList<QString> var; for a list with filenames.
at an amount of 20000 files the processing slowed downed this much, that it seems to be a delay function "sleeping" for milliseconds.
maybe this is also part of the discussion about "how much entries could a QList object have?" ...

//SiL

That's quite a small list. I have used larger ones many times without issues. It is about how you use a list, that decides whether it is "slow" or "fast". If you want to iterate over 20000 items then regardless if it is going to be QList or some other data structure, it is going to take time.