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. Application takes huge amount of ram
Qt 6.11 is out! See what's new in the release blog

Application takes huge amount of ram

Scheduled Pinned Locked Moved Unsolved General and Desktop
19 Posts 5 Posters 2.2k Views 3 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.
  • JoeCFDJ JoeCFD
    1. You add these 10 widgets to the stacked widget one after another to see which one causes memory problem.
    2. if the memory usage goes up linearly, then checking one may be good enough. You use tools and ways to find that out.
    Thank YouT Offline
    Thank YouT Offline
    Thank You
    wrote on last edited by Thank You
    #7

    @JoeCFD and @jsulm
    There are many leaks in core dll than my application.
    I used deleaker for this to find
    What can I do for it??
    87f74a18-ac16-486f-a084-d046e733330c-image.png
    Does it mean there are leaks in core dll too??

    Let's make QT free or It will go forever

    TRUE AND FALSE <3

    artwawA 1 Reply Last reply
    0
    • JoeCFDJ Offline
      JoeCFDJ Offline
      JoeCFD
      wrote on last edited by JoeCFD
      #8

      If that is the case, simply select another version of Qt. I am not aware of Qt-5.12.8 has so many problems, especially in Qt5Core. Hard to imagine this.

      If you have the same problem with another version of Qt(for example 5.15.2), it is likely your code(not Qt) has problem.

      1 Reply Last reply
      0
      • Thank YouT Thank You

        @JoeCFD and @jsulm
        There are many leaks in core dll than my application.
        I used deleaker for this to find
        What can I do for it??
        87f74a18-ac16-486f-a084-d046e733330c-image.png
        Does it mean there are leaks in core dll too??

        artwawA Offline
        artwawA Offline
        artwaw
        wrote on last edited by artwaw
        #9

        @Thank-You There is something fishy about either this tool (first time I see it) or your code. I write tools that use SQLite for everything, users leave those tools running for days sometimes and no extensive memory use have ever been detected. And we are talking about shitty windows budget office machines here.
        I'd like to see the code before I'll decide that Qt libraries have issues with memory leaks on that scale.

        EDIT:
        I started to google and found this post: https://www.francescmm.com/deleaker-review-on-gitqlient/
        Author also found leaks in Qt libraries and states:

        This scared me a lot, because I wasn’t expecting to get so many leaks to start with. But I was wrong: when I took the snapshots, the objects are attached to the life of their parent widget. So, for now I don’t need to worry!
        

        For more information please re-read.

        Kind Regards,
        Artur

        Thank YouT 1 Reply Last reply
        0
        • artwawA artwaw

          @Thank-You There is something fishy about either this tool (first time I see it) or your code. I write tools that use SQLite for everything, users leave those tools running for days sometimes and no extensive memory use have ever been detected. And we are talking about shitty windows budget office machines here.
          I'd like to see the code before I'll decide that Qt libraries have issues with memory leaks on that scale.

          EDIT:
          I started to google and found this post: https://www.francescmm.com/deleaker-review-on-gitqlient/
          Author also found leaks in Qt libraries and states:

          This scared me a lot, because I wasn’t expecting to get so many leaks to start with. But I was wrong: when I took the snapshots, the objects are attached to the life of their parent widget. So, for now I don’t need to worry!
          
          Thank YouT Offline
          Thank YouT Offline
          Thank You
          wrote on last edited by Thank You
          #10

          @artwaw I used Deleaker sir.
          Followed official documentation to do my work but it just show this
          On my application it says leaking in just 5 files and with very low allocation size whereas it shows huge allocation in QtLibraries
          I have used SQLITE for fetching data in every page again it inserts data from all pages and keep tracks of every transaction.

          This is updated code that I use
          I have promoted widgets in stacked widgets

          Just updated version of upper codes

          #ifndef MAINWIN_H
          #define MAINWIN_H
          
          #include <QMainWindow>
          #pragma once
          #include<database.h>
          #include<quitdialog.h>
          
          
          
          
          
          
          QT_BEGIN_NAMESPACE
          namespace Ui { class mainwin; }
          QT_END_NAMESPACE
          
          class mainwin : public QMainWindow
          {
              Q_OBJECT
          
          public:
              mainwin(QWidget *parent = nullptr);
              ~mainwin();
              void connections();
              void closeEvent(QCloseEvent *event);
              database d;
               QString databaseName = d.getDatabaseName();
          
          
          private slots:
              void logout_button_clicked_slot();
              void new_shipment_button_clicked_slot();
              void confirmation_button_clicked_slot();
              void account_button_clicked_slot();
              void more_button_clicked_slot();
              void dashboard_button_clicked_slot();
              void settings_button_clicked_slot();
              void report_button_clicked_slot();
              void advanced_button_clicked_slot();
              void ham_burger_button_clicked_slot();
              void messages_button_clicked_slot();
              void quit_button_clicked_slot();
              void on_menuDocumentation_triggered();
          
          private:
              Ui::mainwin *ui;
               bool hamClicked;
               bool closeApp;
          
          };
          #endif // MAINWIN_H
          
          

          I remove all the pointers from here but there is no any gain in performance and is allocating same amount of memory

          Below file is mainwin.cpp

          #include "mainwin.h"
          #include "ui_mainwin.h"
          
          mainwin::mainwin(QWidget *parent)
              : QMainWindow(parent)
              , ui(new Ui::mainwin)
          {
              ui->setupUi(this);
              ui->mainApp->setCurrentIndex(0);
              connections();
              hamClicked = true;
              ui->nav->setMinimumWidth(200);
              ui->nav->setMaximumWidth(200);
          
          }
          
          mainwin::~mainwin()
          {
              delete ui;
          }
          void mainwin::connections(){
              navigation *nav_bar = ui->navigationBar;
              login *log = ui->loginPage;
          
              connect(log,SIGNAL(login_button_clicked_signal(QString , QString, QString)),nav_bar,SLOT(login_button_clicked_slot(QString,QString,QString)));
              connect(nav_bar,SIGNAL(logout_button_clicked_signal()),this,SLOT(logout_button_clicked_slot()));
              connect(nav_bar,SIGNAL(new_shipment_button_clicked_signal()),this,SLOT(new_shipment_button_clicked_slot()));
              connect(nav_bar,SIGNAL(confirmation_button_clicked_signal()),this,SLOT(confirmation_button_clicked_slot()));
              connect(nav_bar,SIGNAL(account_button_clicked_signal()),this,SLOT(account_button_clicked_slot()));
              connect(nav_bar,SIGNAL(more_button_clicked_signal()),this,SLOT(more_button_clicked_slot()));
              connect(nav_bar,SIGNAL(dashboard_button_clicked_signal()),this,SLOT(dashboard_button_clicked_slot()));
              connect(nav_bar,SIGNAL(settings_button_clicked_signal()),this,SLOT(settings_button_clicked_slot()));
              connect(nav_bar,SIGNAL(report_button_clicked_signal()),this,SLOT(report_button_clicked_slot()));
              connect(nav_bar,SIGNAL(advanced_button_clicked_signal()),this,SLOT(advanced_button_clicked_slot()));
              connect(log,SIGNAL(login_button_clicked_signal(QString , QString, QString)),ui->settings,SLOT(login_button_clicked_slot(QString,QString,QString)));
              connect(log,SIGNAL(login_button_clicked_signal(QString , QString, QString)),ui->messages,SLOT(login_button_clicked_slot(QString,QString,QString)));
              connect(nav_bar,SIGNAL(ham_burger_button_clicked_signal()),this,SLOT(ham_burger_button_clicked_slot()));
              connect(nav_bar,SIGNAL(messages_button_clicked_signal()),this,SLOT(messages_button_clicked_slot()));
              connect(log,SIGNAL(login_button_clicked_signal(QString , QString, QString)),ui->newShipment,SLOT(login_button_clicked_slot(QString,QString,QString)));
          
          
          }
          
          void mainwin::logout_button_clicked_slot()
          {
              // it is default page
              ui->mainApp->setCurrentIndex(0);
          }
          
          void mainwin::new_shipment_button_clicked_slot()
          {
              ui->newShipment->clearValues();
              ui->newShipment->mainFunction();
              ui->mainApp->setCurrentWidget(ui->newShipment);
          
          }
          
          void mainwin::confirmation_button_clicked_slot()
          {
          
              ui->mainApp->setCurrentWidget(ui->confirmation);
          }
          
          void mainwin::account_button_clicked_slot()
          {
          
              ui->account->mainFunction();
          
              ui->mainApp->setCurrentWidget(ui->account);
          
          }
          
          void mainwin::more_button_clicked_slot()
          {
          
              ui->mainApp->setCurrentWidget(ui->moreThings);
          
          }
          
          void mainwin::dashboard_button_clicked_slot()
          {
              ui->dashboard->mainFunction();
              ui->mainApp->setCurrentWidget(ui->dashboard);
          
          
          }
          
          void mainwin::settings_button_clicked_slot()
          {
              ui->dashboard->mainFunction();
              ui->mainApp->setCurrentWidget(ui->settings);
          
          }
          
          void mainwin::report_button_clicked_slot()
          {
              ui->report->mainFunction();
              ui->mainApp->setCurrentWidget(ui->report);
          
          }
          
          void mainwin::advanced_button_clicked_slot()
          {
              ui->mainApp->setCurrentWidget(ui->fullSettings);
          }
          
          void mainwin::messages_button_clicked_slot()
          {
          
              ui->mainApp->setCurrentWidget(ui->messages);
          
          }
          
          void mainwin::ham_burger_button_clicked_slot()
          {
              if(hamClicked){
                  ui->nav->setMaximumWidth(60);
                  ui->nav->setMinimumWidth(60);
                  hamClicked = false;
              }else{
                  ui->nav->setMinimumWidth(200);
                  ui->nav->setMaximumWidth(200);
                  hamClicked = true;
              }
          
          }
          
          void mainwin::quit_button_clicked_slot()
          {
              closeApp = true;
              QCoreApplication::quit();
          }
          
          void mainwin::closeEvent (QCloseEvent *event)
          {
              quitdialog closeApplication;
              connect(&closeApplication,SIGNAL(quit_button_clicked_signal()),this,SLOT(quit_button_clicked_slot()));
              event->accept();
            
          }
          

          In the main entrypoint of application I have just inserted css files using textstream from resources files
          database.h contains all headers included
          That's it
          What may be the cause of it ?
          EDIT:
          In addition to it when I add dialog at the closeEvent then it reports
          Insufficient Memory case 4

          Let's make QT free or It will go forever

          TRUE AND FALSE <3

          Thank YouT 1 Reply Last reply
          0
          • Thank YouT Thank You

            @artwaw I used Deleaker sir.
            Followed official documentation to do my work but it just show this
            On my application it says leaking in just 5 files and with very low allocation size whereas it shows huge allocation in QtLibraries
            I have used SQLITE for fetching data in every page again it inserts data from all pages and keep tracks of every transaction.

            This is updated code that I use
            I have promoted widgets in stacked widgets

            Just updated version of upper codes

            #ifndef MAINWIN_H
            #define MAINWIN_H
            
            #include <QMainWindow>
            #pragma once
            #include<database.h>
            #include<quitdialog.h>
            
            
            
            
            
            
            QT_BEGIN_NAMESPACE
            namespace Ui { class mainwin; }
            QT_END_NAMESPACE
            
            class mainwin : public QMainWindow
            {
                Q_OBJECT
            
            public:
                mainwin(QWidget *parent = nullptr);
                ~mainwin();
                void connections();
                void closeEvent(QCloseEvent *event);
                database d;
                 QString databaseName = d.getDatabaseName();
            
            
            private slots:
                void logout_button_clicked_slot();
                void new_shipment_button_clicked_slot();
                void confirmation_button_clicked_slot();
                void account_button_clicked_slot();
                void more_button_clicked_slot();
                void dashboard_button_clicked_slot();
                void settings_button_clicked_slot();
                void report_button_clicked_slot();
                void advanced_button_clicked_slot();
                void ham_burger_button_clicked_slot();
                void messages_button_clicked_slot();
                void quit_button_clicked_slot();
                void on_menuDocumentation_triggered();
            
            private:
                Ui::mainwin *ui;
                 bool hamClicked;
                 bool closeApp;
            
            };
            #endif // MAINWIN_H
            
            

            I remove all the pointers from here but there is no any gain in performance and is allocating same amount of memory

            Below file is mainwin.cpp

            #include "mainwin.h"
            #include "ui_mainwin.h"
            
            mainwin::mainwin(QWidget *parent)
                : QMainWindow(parent)
                , ui(new Ui::mainwin)
            {
                ui->setupUi(this);
                ui->mainApp->setCurrentIndex(0);
                connections();
                hamClicked = true;
                ui->nav->setMinimumWidth(200);
                ui->nav->setMaximumWidth(200);
            
            }
            
            mainwin::~mainwin()
            {
                delete ui;
            }
            void mainwin::connections(){
                navigation *nav_bar = ui->navigationBar;
                login *log = ui->loginPage;
            
                connect(log,SIGNAL(login_button_clicked_signal(QString , QString, QString)),nav_bar,SLOT(login_button_clicked_slot(QString,QString,QString)));
                connect(nav_bar,SIGNAL(logout_button_clicked_signal()),this,SLOT(logout_button_clicked_slot()));
                connect(nav_bar,SIGNAL(new_shipment_button_clicked_signal()),this,SLOT(new_shipment_button_clicked_slot()));
                connect(nav_bar,SIGNAL(confirmation_button_clicked_signal()),this,SLOT(confirmation_button_clicked_slot()));
                connect(nav_bar,SIGNAL(account_button_clicked_signal()),this,SLOT(account_button_clicked_slot()));
                connect(nav_bar,SIGNAL(more_button_clicked_signal()),this,SLOT(more_button_clicked_slot()));
                connect(nav_bar,SIGNAL(dashboard_button_clicked_signal()),this,SLOT(dashboard_button_clicked_slot()));
                connect(nav_bar,SIGNAL(settings_button_clicked_signal()),this,SLOT(settings_button_clicked_slot()));
                connect(nav_bar,SIGNAL(report_button_clicked_signal()),this,SLOT(report_button_clicked_slot()));
                connect(nav_bar,SIGNAL(advanced_button_clicked_signal()),this,SLOT(advanced_button_clicked_slot()));
                connect(log,SIGNAL(login_button_clicked_signal(QString , QString, QString)),ui->settings,SLOT(login_button_clicked_slot(QString,QString,QString)));
                connect(log,SIGNAL(login_button_clicked_signal(QString , QString, QString)),ui->messages,SLOT(login_button_clicked_slot(QString,QString,QString)));
                connect(nav_bar,SIGNAL(ham_burger_button_clicked_signal()),this,SLOT(ham_burger_button_clicked_slot()));
                connect(nav_bar,SIGNAL(messages_button_clicked_signal()),this,SLOT(messages_button_clicked_slot()));
                connect(log,SIGNAL(login_button_clicked_signal(QString , QString, QString)),ui->newShipment,SLOT(login_button_clicked_slot(QString,QString,QString)));
            
            
            }
            
            void mainwin::logout_button_clicked_slot()
            {
                // it is default page
                ui->mainApp->setCurrentIndex(0);
            }
            
            void mainwin::new_shipment_button_clicked_slot()
            {
                ui->newShipment->clearValues();
                ui->newShipment->mainFunction();
                ui->mainApp->setCurrentWidget(ui->newShipment);
            
            }
            
            void mainwin::confirmation_button_clicked_slot()
            {
            
                ui->mainApp->setCurrentWidget(ui->confirmation);
            }
            
            void mainwin::account_button_clicked_slot()
            {
            
                ui->account->mainFunction();
            
                ui->mainApp->setCurrentWidget(ui->account);
            
            }
            
            void mainwin::more_button_clicked_slot()
            {
            
                ui->mainApp->setCurrentWidget(ui->moreThings);
            
            }
            
            void mainwin::dashboard_button_clicked_slot()
            {
                ui->dashboard->mainFunction();
                ui->mainApp->setCurrentWidget(ui->dashboard);
            
            
            }
            
            void mainwin::settings_button_clicked_slot()
            {
                ui->dashboard->mainFunction();
                ui->mainApp->setCurrentWidget(ui->settings);
            
            }
            
            void mainwin::report_button_clicked_slot()
            {
                ui->report->mainFunction();
                ui->mainApp->setCurrentWidget(ui->report);
            
            }
            
            void mainwin::advanced_button_clicked_slot()
            {
                ui->mainApp->setCurrentWidget(ui->fullSettings);
            }
            
            void mainwin::messages_button_clicked_slot()
            {
            
                ui->mainApp->setCurrentWidget(ui->messages);
            
            }
            
            void mainwin::ham_burger_button_clicked_slot()
            {
                if(hamClicked){
                    ui->nav->setMaximumWidth(60);
                    ui->nav->setMinimumWidth(60);
                    hamClicked = false;
                }else{
                    ui->nav->setMinimumWidth(200);
                    ui->nav->setMaximumWidth(200);
                    hamClicked = true;
                }
            
            }
            
            void mainwin::quit_button_clicked_slot()
            {
                closeApp = true;
                QCoreApplication::quit();
            }
            
            void mainwin::closeEvent (QCloseEvent *event)
            {
                quitdialog closeApplication;
                connect(&closeApplication,SIGNAL(quit_button_clicked_signal()),this,SLOT(quit_button_clicked_slot()));
                event->accept();
              
            }
            

            In the main entrypoint of application I have just inserted css files using textstream from resources files
            database.h contains all headers included
            That's it
            What may be the cause of it ?
            EDIT:
            In addition to it when I add dialog at the closeEvent then it reports
            Insufficient Memory case 4

            Thank YouT Offline
            Thank YouT Offline
            Thank You
            wrote on last edited by Thank You
            #11

            @SGaist and @JonB sir,
            Can you see this?

            Let's make QT free or It will go forever

            TRUE AND FALSE <3

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #12

              Unused stuff can get optimized out by the compiler hence no memory allocated.

              Without any information about what the reports give you it's hard to answer.

              Note that detectors might find false positives. For example Valgrind needs suppression files to remove some stuff that it detects as errors which are in fact not.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              Thank YouT 1 Reply Last reply
              0
              • SGaistS SGaist

                Unused stuff can get optimized out by the compiler hence no memory allocated.

                Without any information about what the reports give you it's hard to answer.

                Note that detectors might find false positives. For example Valgrind needs suppression files to remove some stuff that it detects as errors which are in fact not.

                Thank YouT Offline
                Thank YouT Offline
                Thank You
                wrote on last edited by
                #13

                @SGaist
                But if I leave the application for about 5 minutes ,
                it just takes 120 - 160mb or less than that of ram .
                What may be the reason

                Let's make QT free or It will go forever

                TRUE AND FALSE <3

                1 Reply Last reply
                0
                • Thank YouT Thank You

                  @jsulm

                  mainWin.h
                  
                  #ifndef MAINWIN_H
                  #define MAINWIN_H
                  
                  #include <QMainWindow>
                  #include<QProgressBar>
                  #pragma once
                  #include<database.h>
                  #include<navigation.h>
                  #include<QString>
                  
                  #include<QCloseEvent>
                  #include<quitdialog.h>
                  //for this only
                  #include<dashboardform.h>
                  #include<messagesform.h>
                  #include<newshipmentform.h>
                  #include<confirmationmodificationform.h>
                  #include<accountform.h>
                  #include<reportform.h>
                  #include<morethingsform.h>
                  #include<settingsform.h>
                  #include<fullsettingsform.h>
                  #include<currentlogin.h>
                  
                  
                  
                  
                  
                  QT_BEGIN_NAMESPACE
                  namespace Ui { class mainwin; }
                  QT_END_NAMESPACE
                  
                  class mainwin : public QMainWindow
                  {
                      Q_OBJECT
                  
                  public:
                      mainwin(QWidget *parent = nullptr);
                      ~mainwin();
                      void connections();
                      navigation *nav_bar;
                      void closeEvent(QCloseEvent *event);
                      database d;
                       QString databaseName = d.getDatabaseName();
                  
                  
                  private slots:
                      void logout_button_clicked_slot();
                      void new_shipment_button_clicked_slot();
                      void confirmation_button_clicked_slot();
                      void account_button_clicked_slot();
                      void more_button_clicked_slot();
                      void dashboard_button_clicked_slot();
                      void settings_button_clicked_slot();
                      void report_button_clicked_slot();
                      void advanced_button_clicked_slot();
                      void ham_burger_button_clicked_slot();
                      void messages_button_clicked_slot();
                      void quit_button_clicked_slot();
                      void on_menuDocumentation_triggered();
                  
                  private:
                      Ui::mainwin *ui;
                       bool hamClicked;
                       messagesForm *messages ;
                       dashboardForm * dashboard ;
                       newShipmentForm *newShipment;
                       confirmationModificationForm * confirmationModification ;
                       accountForm * account  ;
                       reportForm *report;
                       moreThingsForm *moreThings;
                       settingsForm * settings;
                       fullSettingsForm *fullSettings;
                       quitdialog closeApplication;
                       bool closeApp;
                      
                  };
                  #endif // MAINWIN_H
                  
                  

                  this is mainwin.cpp

                  #include "mainwin.h"
                  #include "ui_mainwin.h"
                  mainwin::mainwin(QWidget *parent)
                      : QMainWindow(parent)
                      , ui(new Ui::mainwin)
                  {
                      ui->setupUi(this);
                  ui->mainApp->setCurrentIndex(0);
                  
                  connections();
                  
                  hamClicked = true;
                  ui->nav->setMinimumWidth(200);
                  ui->nav->setMaximumWidth(200);
                  
                  messages = ui->messages;
                  dashboard = ui->dashboard;
                  newShipment = ui->newShipment;
                  confirmationModification = ui->confirmation;
                  account  = ui->account;
                  report = ui->report;
                  moreThings = ui->moreThings;
                  settings = ui->settings;
                  fullSettings = ui->fullSettings;
                  }
                  
                  mainwin::~mainwin()
                  {
                      delete ui;
                  }
                  void mainwin::connections(){
                  nav_bar = ui->navigationBar;
                  
                      login *log = ui->loginPage;
                      connect(log,SIGNAL(login_button_clicked_signal(QString , QString, QString)),nav_bar,SLOT(login_button_clicked_slot(QString,QString,QString)));
                      connect(nav_bar,SIGNAL(logout_button_clicked_signal()),this,SLOT(logout_button_clicked_slot()));
                      connect(nav_bar,SIGNAL(new_shipment_button_clicked_signal()),this,SLOT(new_shipment_button_clicked_slot()));
                      connect(nav_bar,SIGNAL(confirmation_button_clicked_signal()),this,SLOT(confirmation_button_clicked_slot()));
                      connect(nav_bar,SIGNAL(account_button_clicked_signal()),this,SLOT(account_button_clicked_slot()));
                      connect(nav_bar,SIGNAL(more_button_clicked_signal()),this,SLOT(more_button_clicked_slot()));
                      connect(nav_bar,SIGNAL(dashboard_button_clicked_signal()),this,SLOT(dashboard_button_clicked_slot()));
                      connect(nav_bar,SIGNAL(settings_button_clicked_signal()),this,SLOT(settings_button_clicked_slot()));
                      connect(nav_bar,SIGNAL(report_button_clicked_signal()),this,SLOT(report_button_clicked_slot()));
                      connect(nav_bar,SIGNAL(advanced_button_clicked_signal()),this,SLOT(advanced_button_clicked_slot()));
                      connect(log,SIGNAL(login_button_clicked_signal(QString , QString, QString)),ui->settings,SLOT(login_button_clicked_slot(QString,QString,QString)));
                      connect(log,SIGNAL(login_button_clicked_signal(QString , QString, QString)),ui->messages,SLOT(login_button_clicked_slot(QString,QString,QString)));
                      connect(nav_bar,SIGNAL(ham_burger_button_clicked_signal()),this,SLOT(ham_burger_button_clicked_slot()));
                      connect(nav_bar,SIGNAL(messages_button_clicked_signal()),this,SLOT(messages_button_clicked_slot()));
                      connect(log,SIGNAL(login_button_clicked_signal(QString , QString, QString)),ui->newShipment,SLOT(login_button_clicked_slot(QString,QString,QString)));
                  
                  
                      connect(&closeApplication,SIGNAL(quit_button_clicked_signal()),this,SLOT(quit_button_clicked_slot()));
                  
                  
                  }
                  
                  void mainwin::logout_button_clicked_slot()
                  {
                      // it is default page
                      ui->mainApp->setCurrentIndex(0);
                  }
                  
                  void mainwin::new_shipment_button_clicked_slot()
                  {
                  ui->newShipment->clearValues();
                  ui->newShipment->mainFunction();
                  //ui->mainApp->setCurrentIndex(1);
                  ui->mainApp->setCurrentWidget(newShipment);
                   
                  }
                  
                  void mainwin::confirmation_button_clicked_slot()
                  {
                  //ui->mainApp->setCurrentIndex(2);
                  ui->mainApp->setCurrentWidget(confirmationModification);
                   
                  
                  }
                  
                  void mainwin::account_button_clicked_slot()
                  {
                      ui->account->mainFunction();
                  //    ui->mainApp->setCurrentIndex(3);
                      ui->mainApp->setCurrentWidget(account);
                       
                  }
                  
                  void mainwin::more_button_clicked_slot()
                  {
                  
                  //    ui->mainApp->setCurrentIndex(4);
                      ui->mainApp->setCurrentWidget(moreThings);
                       
                  }
                  
                  void mainwin::dashboard_button_clicked_slot()
                  {
                      ui->dashboard->mainFunction();
                  //    ui->mainApp->setCurrentIndex(5);
                      ui->mainApp->setCurrentWidget(dashboard);
                       
                  
                  }
                  
                  void mainwin::settings_button_clicked_slot()
                  {
                      ui->dashboard->mainFunction();
                  //    ui->mainApp->setCurrentIndex(6);
                      ui->mainApp->setCurrentWidget(settings);
                       
                  }
                  
                  void mainwin::report_button_clicked_slot()
                  {
                      ui->report->mainFunction();
                  //    ui->mainApp->setCurrentIndex(7);
                      ui->mainApp->setCurrentWidget(report);
                  
                  }
                  
                  void mainwin::advanced_button_clicked_slot()
                  {
                  //    ui->mainApp->setCurrentIndex(8);
                      ui->mainApp->setCurrentWidget(fullSettings);
                  }
                  
                  void mainwin::messages_button_clicked_slot()
                  {
                  //    ui->mainApp->setCurrentIndex(9);
                      ui->mainApp->setCurrentWidget(messages);
                  
                  }
                  
                  void mainwin::ham_burger_button_clicked_slot()
                  {
                      if(hamClicked){
                          ui->nav->setMaximumWidth(60);
                         ui->nav->setMinimumWidth(60);
                          hamClicked = false;
                      }else{
                  
                          ui->nav->setMinimumWidth(200);
                          ui->nav->setMaximumWidth(200);
                          hamClicked = true;
                      }
                  
                  }
                  
                  void mainwin::quit_button_clicked_slot()
                  {
                      closeApp = true;
                    QCoreApplication::quit();
                  }
                  
                  void mainwin::closeEvent (QCloseEvent *event)
                  {
                      event->accept();
                  /*connect with logic*/
                   
                  }
                  
                  
                  

                  These are main two files
                  All other are connected through this

                  SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #14

                  Profile your application to see what eats memory.

                  @Thank-You said in Application takes huge amount of ram:

                  database d;

                  That thing here we know nothing about so it might be as well it that is leaking memory depending on how you use it and what it does.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  Thank YouT 1 Reply Last reply
                  0
                  • SGaistS SGaist

                    Profile your application to see what eats memory.

                    @Thank-You said in Application takes huge amount of ram:

                    database d;

                    That thing here we know nothing about so it might be as well it that is leaking memory depending on how you use it and what it does.

                    Thank YouT Offline
                    Thank YouT Offline
                    Thank You
                    wrote on last edited by
                    #15

                    @SGaist

                    #ifndef DATABASE_H
                    #define DATABASE_H
                    
                    #pragma once
                    #include<QString>
                    #include<QFile>
                    #include<QMessageBox>
                    #include<QDebug>
                    #include<ctime>
                    #include<QTextStream>
                    #include<errorsexpress.h>
                    #include<QSql>
                    #include<QtSql/QSql>
                    #include<QtSql/QSqlDatabase>
                    #include<QtSql/QSqlQuery>
                    #include<QtSql/QSqlDriver>
                    #include<QtSql/QSqlQuery>
                    #include<QtSql/QSqlQueryModel>
                    #include<QSqlError>
                    
                    class database
                    {
                    
                    public:
                        database();
                        QString readTextFile(QString path);
                        QString getDatabaseName();
                    
                        QString getUsername();
                        QString getId();
                        QString getPost();
                    
                        void saveRequest(QString user_id ,QString special_value, QString operation,QString page);
                        ErrorsExpress ERRORS;
                    
                    };
                    
                    #endif // DATABASE_H
                    
                    

                    database.cpp implements just these functions straight forward. Contains all headers that are needed in every other files
                    It is included in every files.
                    Please say something on these
                    But if I leave the application for about 5 minutes ,
                    it just takes 120 - 160mb or less than that of ram .
                    What may be the reason

                    Let's make QT free or It will go forever

                    TRUE AND FALSE <3

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #16

                      Since you have a database, what are you loading from it ?

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      Thank YouT 1 Reply Last reply
                      0
                      • SGaistS SGaist

                        Since you have a database, what are you loading from it ?

                        Thank YouT Offline
                        Thank YouT Offline
                        Thank You
                        wrote on last edited by
                        #17

                        @SGaist
                        It's like CRUD application but it saves every transaction,
                        It has 8 tables
                        It shows all inserted data, prepare simple report in tableView.
                        There are almost 50 queries within the program

                        Let's make QT free or It will go forever

                        TRUE AND FALSE <3

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #18

                          How many transaction are we looking at ?
                          How are you storing them ?

                          Interested in AI ? www.idiap.ch
                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                          Thank YouT 1 Reply Last reply
                          0
                          • SGaistS SGaist

                            How many transaction are we looking at ?
                            How are you storing them ?

                            Thank YouT Offline
                            Thank YouT Offline
                            Thank You
                            wrote on last edited by
                            #19

                            @SGaist
                            FIXED BUT
                            I have 9 tables with max 28 columns and min of 8 columns.
                            On every database query I am using saving type of query(like on every transaction)
                            Sir problem is solved now. I uninstalled and installed the Qt(same offline installer). It is using just 200-300mb ram on average and it's not that problem. I don't know the reason but problem is fixed. The problem is fixed but do you have any idea , why this happened?

                            Let's make QT free or It will go forever

                            TRUE AND FALSE <3

                            1 Reply Last reply
                            0

                            • Login

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