Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. How to minimize Qt program memory usage
Forum Updated to NodeBB v4.3 + New Features

How to minimize Qt program memory usage

Scheduled Pinned Locked Moved Mobile and Embedded
7 Posts 3 Posters 10.7k 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.
  • W Offline
    W Offline
    wenc
    wrote on last edited by
    #1

    HI, I found that just an empty window of Qt GUI application takes 4.8M memory. Could I minimize these memory usage? I am pretty new to Qt and currently using Qt Creator to program. Thank you very much!

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      The 4.8 MB are an exe compiled with debug options?
      Release compiled version are in general much smaller than a debug compilation. Furthermore, you can check memory optimization of your compiler. AFAIK all compiler have one or in another to decide whether to optimize for memory usage or for speed. However, those options are only available in release mode compilations.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • W Offline
        W Offline
        wenc
        wrote on last edited by
        #3

        Thanks for reply. The released exe file are only 308 KB. But take 4.8MB memory when it starts. The program is just an empty window. Could you tell me which compiler option can optimize the memory usage? Thanks.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          Adrien Leravat
          wrote on last edited by
          #4

          Hi wenc,

          The program in memory will take it's executable size, plus the size of dynamic libraries needed (QtCore, QtGUI, etc.).
          To lower your memory usage, in addition to what koahnig said, be sure to avoid including unnecessary libraries, and use the configuration step to remove unwanted parts of Qt. Removing unwanted Qt parts can lower Qt libraries size by 50%.

          Qt source ships a small configuration tool called qconfig, that visually displays selectable parts of libraries, and let you remove the ones you do not want. It will generate a c++ header file, that can be used with the -qconfig <config_file> flag, during configuration.
          You can also save those -no-xxx flags in your platform mkspec.

          Adeneo Embedded - www.adeneo-embedded.com

          1 Reply Last reply
          0
          • W Offline
            W Offline
            wenc
            wrote on last edited by
            #5

            Thanks, Adrien. I opened qconfig which asked for Qt Features file. I don't know where to find it and couldn't find related documents of qconfig. Could you give an example? I would appreciate it. Thanks.

            1 Reply Last reply
            0
            • W Offline
              W Offline
              wenc
              wrote on last edited by
              #6

              I found the document in here http://qt-project.org/doc/qt-4.8/fine-tuning-features.html. Thank you for the informations!

              1 Reply Last reply
              0
              • A Offline
                A Offline
                Adrien Leravat
                wrote on last edited by
                #7

                Yes that's the one. I repost the URL as yours has a trailing dot, leading to a 404.
                "Qt 4.8 Fine tuning feature":http://qt-project.org/doc/qt-4.8/fine-tuning-features.html
                Glad to help :)

                Adeneo Embedded - www.adeneo-embedded.com

                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