Important: Please read the Qt Code of Conduct -

QScintillna (Want to check memory usage of lines in following Qt code in a profiler tool

  • void GQSciEdit::loadSourceFile(const QString& ofilename)

    if (ofilename.isEmpty()) {
    setText("<EMPTY FILE>");
    filename = "";

     if (ofilename.endsWith(".gpg") || ofilename.endsWith(".odb")) {
       setText("<ENCRYPTED FILE>");
       filename = "";
     if (filename != ofilename) {
       QString msg = QString("Loaded file %1").arg(ofilename);
         if (FILE* fp = UFile::open(ofilename.toLatin1(), "r")) {
       QTextStream ts(fp, QIODevice::ReadOnly);
       d_filename = ofilename;
       emit fileNameChanged(ofilename);

    I want to check memory usage of following line in above code setText(ts.readAll()); Can some one tell me the tool for it

    [edit: koahnig] Added some spaces for code visualisation.

  • @Qt-Enthusiast

    Profilers are typically dependent on OS. You may have a look to gprof

    On the other hand profilers eat a lot of CPU. Therefore do not try it on your large file. Probably it is much easier for you to measure time and required time with QElapsedTimer.

Log in to reply