QT app consume RAM
-
I am try to build a simple QT widget application in a buildroot linux,it contains two buttons ,but do nothing.The QT version is 5.6,it's configuration as below:
The QT app's pro add base display config:QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = simpleQT
TEMPLATE = appwhat puzzle me is that the app consume about 39760KB RAM(memstat tool detail as below)
So,I want to know is:
1.Why a simple QT app itself consume about 11540KB RAM;
2.libQt5Gui.so,libQt5Widgets.so and libQt5Core.so also consume 15460KB RAM;
3.Anyone knows how to reduce QT app itself and shared lib RAM consume? -
Your app itself consumes only 20k of RAM. The rest are shared libraries, many of them system libraries - they will be loaded for most programs you run, so you should not worry about it. It's normal.
Regarding other questions. There are many ways to reduce size:
- use Qt Lite http://blog.qt.io/blog/2016/08/18/introducing-the-qt-lite-project-qt-for-any-platform-any-thing-any-size/ http://blog.qt.io/blog/2017/05/31/qt-lite-qt-5-9-lts/
- compile Qt statically, with -reduce-relocations
- compile your app statically
- enable compiler flag -Os (optimize for size) - for Qt and for your app
-
Your app itself consumes only 20k of RAM. The rest are shared libraries, many of them system libraries - they will be loaded for most programs you run, so you should not worry about it. It's normal.
Regarding other questions. There are many ways to reduce size:
- use Qt Lite http://blog.qt.io/blog/2016/08/18/introducing-the-qt-lite-project-qt-for-any-platform-any-thing-any-size/ http://blog.qt.io/blog/2017/05/31/qt-lite-qt-5-9-lts/
- compile Qt statically, with -reduce-relocations
- compile your app statically
- enable compiler flag -Os (optimize for size) - for Qt and for your app