Results 1 to 1 of 1

Thread: qthread memory problem, please help (ignore this, solved)

  1. #1
    Join Date
    Sep 2008
    Posts
    23
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Question qthread memory problem, please help (ignore this, solved)

    My bad, pls ignore the following message. I found it's the std container that does not release memory as I expected, not the qt to blame for. Sorry I can't delete the original post.
    ==============================

    hi, there
    I am doing image processing and using qt for the GUI with qthread for the 4cup machine. Basically in each thread I'll do calculation on different images with no info exchange among threads. The work is queued in the qlist and 4 threads are released at the beginning. Upon receiving the signal of a thread is finished, I'll delete that job and release a new one. Overall, there are 4 threads running until all the jobs are done. Let me call my part as MyWork and the job is started by run()
    Qt Code:
    1. void QtMyWorkAdapter::run()
    2. {
    3. MyWork mywork(dir_of_image.toStdString());
    4. }
    5.  
    6. class QtMyWorkAdapter : public QThread{/*not interesting...*/}
    To copy to clipboard, switch view to plain text mode 

    The program seems has memory leakage somewhere related to qt, the occupied memory is constantly growing until the program crashes after 20 jobs or so. The reason I suspect qthread other than MyWork is that I don't have trouble in memory when I run MyWork directly in batch in the console window for thousands of jobs. But as I said, The program crashed with qt for only 20 jobs or so.

    It seems that after run() is finished, the ~MyWork() is called automatically (which is good). Then all the memory alloc in MyWork should be released (and I do observe the recursive call of distructions for classes used by MyWork).

    I appreciate if someone can point out where to nail down the problem. The valgrind gives message about qt but people said those should be suppressed.

    zl2k
    Last edited by zl2k; 26th September 2008 at 22:23. Reason: updated contents

Similar Threads

  1. QThread problem
    By MrShahi in forum Qt Programming
    Replies: 6
    Last Post: 15th July 2008, 12:28
  2. QThread and PostgreSQL - a problem
    By Lesiok in forum Qt Programming
    Replies: 12
    Last Post: 9th April 2008, 09:07
  3. Problem with QTcpSocket in QThread
    By Raistlin in forum Qt Programming
    Replies: 8
    Last Post: 6th October 2007, 12:23
  4. QThread and QProcess problem
    By codebehind in forum Qt Programming
    Replies: 13
    Last Post: 7th August 2007, 08:11
  5. Memory Problem with SIGNALS and SLOTS
    By ^NyAw^ in forum Qt Programming
    Replies: 1
    Last Post: 19th March 2007, 20:39

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.