Hey Everyone,

I have run into a bit of a problem with regards to application startup...

I have written a C++ application with QT libraries that uses active QT to communicate with our ERP system in our business, the requirements are that any application we use needs to communicate its variables into this application by means of an argument list that uses unique splitters, and the application then checks the command (seperate argument) and handles the variables and inserts into XML to communicate them to the ERP

my issue is this, with larger argument lists (larger applications and more intricate functionality) the application take much longer to start up, functionality from the very first coding line to the finish is quick, as quick as I can possibly get it... but the startup is way too slow...

Is there anything I can do to speed up the startup? can this be caused by the large arguments? or could it be something else, I thought of dll loading as a possibility though I have tested running the application over a network and on the same machine (because to my knowledge dll loading takes even longer over a network) but I found exactly the same result

Thanking everyone in advance for the assistance

Dani AI

Generated

reported slow startup that grows with large argument lists; correctly suggested checking memory issues, but the priority is to measure where time is actually spent before changing code.

A fast way to isolate the problem is to add high-resolution checkpoints in main() and log elapsed times so the slow phase is obvious (process creation, Qt/QPlugin load, argument parsing, ActiveQt/COM init, XML build, etc.). Example:

int main(int argc, char **argv) {
    QElapsedTimer t; t.start();
    qDebug() << "enter main" << t.elapsed();
    QApplication app(argc, argv);
    qDebug() << "after QApplication" << t.elapsed();
    // parse args
    qDebug() << "after args" << t.elapsed();
    // init ActiveQt objects
    qDebug() << "after ActiveQt init" << t.elapsed();
    // create/show window
    qDebug() << "after show" << t.elapsed();
    return app.exec();
}

Common causes and practical mitigations:

  • Heavy synchronous parsing: pass a filename or use stdin/shared memory for very large payloads rather than a huge command line; parse lazily or offload to a worker thread.
  • Static/global constructors and heavy initialization: replace with explicit lazy init so startup does minimal work.
  • Qt plugin/translator/icon loading or ActiveQt/COM initialization: defer QAxWidget/QAxObject creation until needed and test with Qt plugin debug output to see plugin load time.
  • OS/AV or network file I/O delays: use Process Monitor/Dependency Walker or run without AV for a test.
  • Always compare Debug vs Release builds; measure with a profiler if checkpoints are inconclusive.

Cautions: GUI must stay on the main thread; move only CPU/file-bound init to background threads and show a splash/progress indicator while initialization completes.

I'm not a pro in this domain, but I will tell you my opinion. Regardless the fact that the startup is really really slow, it may be due to the fact that your code must be improoved to handle large arguments. As you said, it happens only when dealing with large arguments, and when inputting small lists, it works fine. Have you checked for any memory leeks that would be unseed for small amounts of information? This may be also a reason for a slow startup when inputting large amounts. These memory leeks may seem harmless when dealing with "small lists" but when using a lot of things, it might get messy. You should check for that and get further information searching on Google.
Cheers.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.