Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7506101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:08:47+00:00 2026-05-29T22:08:47+00:00

When just loaded, the app is fairly smooth, however with time passing by, the

  • 0

When just loaded, the app is fairly smooth, however with time passing by, the gui gets slower and slower, which is, when i click a button, it will only take effect after a few seconds(1 or 2).

I have watched the process in task-manager, the memory usage is stable(around 5m), and before i click the buttons, the cpu usage is also 0.

I am using Qt_4.8.0 with visual_studio_2010.

Is it because of the efficiency of qt lib on windows?

Some code:
/////////mainwindow.h////////////

QPushButton* reloadHostsPushButton = new QPushButton("Reload Hosts");
reloadHostsPushButton->setMaximumSize(aPushButtonMaxSize);
connect(reloadHostsPushButton, SIGNAL(clicked()),
        this, SLOT(reloadHostsClicked()));

QPushButton* flushDNSPushButton = new QPushButton("Flush DNS Cache");
flushDNSPushButton->setMaximumSize(aPushButtonMaxSize);
connect(flushDNSPushButton, SIGNAL(clicked()),
        this, SLOT(flushDNSClicked()));

controlPanelLayout = new QGridLayout();
controlPanelLayout->addWidget(openHostsPushButton, 0, 0);
controlPanelLayout->addWidget(reloadHostsPushButton, 0, 1);
controlPanelLayout->addWidget(flushDNSPushButton, 0, 2);
controlPanelLayout->addWidget(quitPushButton, 1, 2);
controlPanelLayout->addWidget(aboutPushButton, 1, 1);
controlPanelLayout->addWidget(optionsPushButton, 1, 0);

controlPanel = new QWidget();
controlPanel->setLayout(controlPanelLayout);

/////////server.h//////////////flushDNSClicked() calls this/////////

void Server::flushDNSCache(){
    ui_LogPanel->log("Flushing DNS cache...", UI_LogPanel::aLogRed);
    QProcess* tmp = new QProcess();
    tmp->start("ipconfig", QStringList() << "/flushdns");
    ui_LogPanel->log("DNS cache flushed!", UI_LogPanel::aLogItalic | UI_LogPanel::aLogGreen);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T22:08:48+00:00Added an answer on May 29, 2026 at 10:08 pm

    Your flushDNSCache() slot function contains a bug and some wishful thinking. Although I don’t think that it will cause the slowdown.

    You are creating a QProcess object but you are never deleting it. And you are printing to the log that the DNS cache is flushed, wishing that everything went okay.

    If you don’t care whether the ipconfig succeeded, you can use QProcess::startDetached as follows:

    void Server::flushDNSCache(){
        ui_LogPanel->log("Flushing DNS cache...", UI_LogPanel::aLogRed);
        QProcess::startDetached("ipconfig", QStringList() << "/flushdns");
        ui_LogPanel->log("DNS cache flushed!", 
            UI_LogPanel::aLogItalic | UI_LogPanel::aLogGreen);
    }
    

    Now you don’t leave any undeleted QProcess objects hanging around.

    Even better would be to use QProcess::execute:

    void Server::flushDNSCache(){
        ui_LogPanel->log("Flushing DNS cache...", UI_LogPanel::aLogRed);
        int exitCode = QProcess::execute("ipconfig", QStringList() << "/flushdns");
        if (exitCode == 0)
        {
            ui_LogPanel->log(
                "DNS cache flushed!", 
                UI_LogPanel::aLogItalic | UI_LogPanel::aLogGreen);
        }
        else
        {
            ui_LogPanel->log(
                QString("DNS cache flush failed with exit code %1!").arg(exitCode), 
                UI_LogPanel::aLogItalic | UI_LogPanel::aLogRed);
        }
    }
    

    Now you can check the exit code. Note however, that the QProcess::execute will wait until the process finishes so if you start long running process your application will freeze until the process finishes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've just solved another *I-though-I-was-using-this-version-of-a-library-but-apparently-my-app-server-has-already-loaded-an-older-version-of-this-library-*issue (sigh). Does anybody know a good way to verify
My Android app has a main WebView (HTML loaded from a local resource) which
I want to make an app which (amongst other things) can parse feeds loaded
I just released my new App iBeat, which worked fine for me and my
I've just finished off an app for the iPhone which, until today, ran fine
I ‘concat’ an id of just loaded image into mysql user record like this.
I'm playing around with ASP.NET MVC and I just loaded up an empty project
I just want to quit as fast as possible, before the nibs are loaded.
I have a view that is loaded in the MainWindow.xib. It is just a
Is there a way to list all the loaded modules using gdb, just like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.