Results 1 to 5 of 5

Thread: QThread won't start

  1. #1
    Join Date
    Jan 2009
    Location
    Germany
    Posts
    387
    Thanks
    101
    Thanked 15 Times in 15 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default QThread won't start

    Hello! I need help with debugging a thread issue. I wrote a Qt application that collects a large amount of experimental data. Then I start a QThread that runs analytic algorithms on the data and outputs some aggregated results. I have been using it for a while without problems, but now for some reason the thread won't start. Instead, it flips me the bird with:

    QThread::start: Failed to create thread (The access code is invalid.)
    I noticed that the thread does start when I record a new set with a small amount of data. But it does not with the 1.6 GB data I load from a file. I don't even know where to start. A little help please?

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QThread won't start

    You are loading 1.6GB into RAM all at once? Windows I assume. 32-bit or 64-bit application?

  3. #3
    Join Date
    Jan 2009
    Location
    Germany
    Posts
    387
    Thanks
    101
    Thanked 15 Times in 15 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QThread won't start

    Yes, and it fits into my RAM so why bother make it more complicated? Windows 7 and 32-bit application. I reduced the data size to about 700 MB just now and the thread starts again. It seems to be connected to the data size somehow.

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QThread won't start

    How is that data loaded? One contiguous lump? Your 32-bit windows process has a maximum memory space of 2 or 3GB (http://msdn.microsoft.com/en-us/libr...#memory_limits) and the largest contiguous lump of that may be (will be) smaller than 1.6GB.

  5. #5
    Join Date
    Jan 2009
    Location
    Germany
    Posts
    387
    Thanks
    101
    Thanked 15 Times in 15 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QThread won't start

    Ah ok I wasn't paying attention to that! But still. The way I load my data is exactly like this:

    Qt Code:
    1. void State::load()
    2. {
    3. QMutexLocker locker(&mutex);
    4.  
    5. QList<State> history;
    6.  
    7. QFile file("data/statehistory.dat");
    8. file.open(QIODevice::ReadOnly);
    9. QDataStream in(&file);
    10.  
    11. while (!in.atEnd())
    12. {
    13. in >> ba;
    14. history << *(State*)(ba.data());
    15. }
    16.  
    17. file.close();
    18. }
    To copy to clipboard, switch view to plain text mode 

    So it appends into a QList one by one. I believe QList does not need contiguous memory for all objects inside, only for the pointers pointing to them. Is that right? There are roughly 200.000 pointers times 32 bit should be less than 1MB. Also, if I tried to allocate more contiguous space than I'm allowed to, the application should crash with a segfault or something. There is no problem with the loading. Everything still works afterwards, except that the data analyzer thread won't start.
    Last edited by Cruz; 3rd February 2014 at 00:41. Reason: updated contents

Similar Threads

  1. QTimer in QThread doesn't start or timeout
    By Boron in forum Qt Programming
    Replies: 9
    Last Post: 21st October 2011, 14:51
  2. Multiple start() on same QThread Object
    By mdecandia in forum Qt Programming
    Replies: 4
    Last Post: 3rd November 2009, 09:14
  3. QThread::start() doesn't invoke run() method
    By seim in forum Qt Programming
    Replies: 2
    Last Post: 5th February 2009, 18:09
  4. Replies: 2
    Last Post: 27th March 2007, 13:09
  5. QThread : run() Vs start()
    By cs_raja in forum Qt Programming
    Replies: 4
    Last Post: 21st November 2006, 11:36

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.