Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-31215

QVector memory management bug causes unexpected out of memory exception

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • None
    • 5.0.2, 5.1.0
    • None
    • Windows 7 64bit, Visual Studio 2010 SP1, Qt5.1.0 beta1 for msvc2010 32bit

    Description

      I've uploaded a QtCreator project to reproduce the issue.

      Test-Setup:
      • Microsoft Windows 7 64bit, Windows 8 64bit
      • Qt5 MSVC2010 32bit (tested with Qt5.0.2, Qt5.1.0)
      • a table model and a table view
      • the model tries to insert a huge amount of items (>40 million items)
      Steps to reproduce:
      • Start application
      Result:
      1. QHeaderView tries to insert 45 million sectionItems in its internal vector, but the QVector<T>::reallocData() function crashes, because the QVector-internal Data::allocate() function causes an out of memory exception.
      2. Here comes an overview about the max. possible rows that can be inserted on different OS and Qt versions, which I was able to test:
          Windows 7 64bit Windows 8 64bit Linux 32/64bit
        Qt5.x.y 44.739.241 89.478.483 119.304.647
        Qt4.8.4 119.304.647 119.304.647 119.304.647

        The max. rowCount of 119.304.647 is OK, because this is the result of MAX_SIGNED_INT / myRowHeight (0x7FFFFFFF / 18), see QTBUG-18490 for more details.

      3. This seems to be a regression bug, because Qt4 is not affected.
      4. Although Qt is platform independent, three different results on three different operating systems can be found.
      Background:

      We are using a large amount of data (up to 100 million items), our table model uses a sqlite database as backend, so in fact only a few items (of our internal prefetch buffer) are in memory, all the rest is on hard disk. The prefetch buffer reduces the SQL access when scrolling the view through all the data. Additionally, we have a lot of filters and search functions to manage such an amount of data easily. Everything works very fine and fast with Qt4, but crashes with Qt5 as described.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            rene René Keimling
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes