Results 1 to 4 of 4

Thread: The maximum size of a QList

  1. #1
    Join Date
    Feb 2009
    Posts
    23
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default The maximum size of a QList

    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.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: The maximum size of a QList

    Quote Originally Posted by Denarius View Post
    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.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    Denarius (28th April 2009)

  4. #3
    Join Date
    Nov 2012
    Posts
    2
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: The maximum size of a QList

    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

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: The maximum size of a QList

    Quote Originally Posted by SiL3NC3 View Post
    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.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. QList, copy problems
    By Valheru in forum Qt Programming
    Replies: 4
    Last Post: 5th February 2010, 00:06
  2. maximum size of xml files
    By freeskydiver in forum Qt Programming
    Replies: 1
    Last Post: 15th January 2008, 10:02
  3. QLabel size policy
    By Caius Aérobus in forum Qt Programming
    Replies: 3
    Last Post: 7th December 2007, 17:57
  4. howto expand frame to maximum size
    By masoroso in forum Newbie
    Replies: 4
    Last Post: 21st April 2006, 09:40
  5. Qt 4.1.1 linker warnings
    By Matt Smith in forum Installation and Deployment
    Replies: 0
    Last Post: 26th February 2006, 22:14

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.