Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QTimer makes the application slow.

QTimer makes the application slow.

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 1.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Fivestar
    wrote on last edited by
    #1

    I made one application having one mainwindow and 7 dialogs.
    Each dialog has some tasks to update data from oracle DB.
    So I used QTimer on mainwindow such that

    QTimer *timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()), mode2, SLOT(mode_update()));
    connect(timer, SIGNAL(timeout()), mode3, SLOT(mode_update()));
    connect(timer, SIGNAL(timeout()), mode4, SLOT(mode_update()));
    connect(timer, SIGNAL(timeout()), mode5, SLOT(mode_update()));
    connect(timer, SIGNAL(timeout()), mode6, SLOT(mode_update()));
    connect(timer, SIGNAL(timeout()), mode7, SLOT(mode_update()));
    timer->start(1000);
    
    QTimer *timer10 = new QTimer(this);
    connect(timer10, SIGNAL(timeout()), mode4, SLOT(mode_update10()));
    connect(timer10, SIGNAL(timeout()), mode5, SLOT(mode_update10()));
    connect(timer10, SIGNAL(timeout()), mode6, SLOT(mode_update10()));
    timer->start(10000);
    

    First, it works well, but, after 1 hour its update cycle delays to 15 second.
    Is there any way to reduce delay?

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      The delays comes from something.

      Often is leaking memory .

      So you should find out why it gets slow.
      There is no reason using timers should become slow over time
      so its something else.

      1 Reply Last reply
      3
      • M Offline
        M Offline
        muratkarakus7
        wrote on last edited by
        #3

        Btw, maybe source of delay is data base connection. I suggest using a stopwatch to record total time spend for each slot. If time doesn't change over time but still you observe the delay, then use valgrind to check memory leaks.

        http://doc.qt.io/qt-4.8/qt-demos-spectrum-3rdparty-fftreal-stopwatch-stopwatch-cpp.html

        1 Reply Last reply
        1

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved