How to minimize Qt program memory usage
-
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. -
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. -
I found the document in here http://qt-project.org/doc/qt-4.8/fine-tuning-features.html. Thank you for the informations!
-
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 :)