| I just tested a simple Qt app on my Linux KDE Neon and it consumes just ~32.3 MB RSS. Simple Qml app memory consumption is ~120.4 MB RSS. $ ps -o pid,rss,command -p $(pgrep -f SimpleQtApp) PID RSS COMMAND 1471929 33052 ./SimpleQtApp $ ps -o pid,rss,command -p $(pgrep -f SimpleQmlApp) PID RSS COMMAND 1478335 123260 ./SimpleQmlApp // Following is the simple Qt app code. #include <QApplication> #include <QWidget> #include <QLabel> #include <QPushButton> #include <QVBoxLayout> int main(int argc, char argv[]) { QApplication app(argc, argv);
QWidget window;
window.setWindowTitle("Qt Simple App (CMake)");
window.resize(300, 150);
QLabel *label = new QLabel("Hello, World!", &window);
label->setAlignment(Qt::AlignCenter);
QPushButton *button = new QPushButton("Click Me", &window);
QVBoxLayout *layout = new QVBoxLayout(&window);
layout->addWidget(label);
layout->addWidget(button);
QObject::connect(button, &QPushButton::clicked, [label]() {
label->setText("You clicked the button!");
});
window.show();
return app.exec();
}// Following is the QML app code #include <QGuiApplication> #include <QQmlApplicationEngine> int main(int argc, char *argv[]) { QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
const QUrl url(QStringLiteral("qrc:/Main.qml"));
QObject::connect(&engine, &QQmlApplicationEngine::objectCreationFailed, &app, []() { QCoreApplication::exit(-1); }, Qt::QueuedConnection);
engine.load(url);
return app.exec();
}// Main.qml import QtQuick import QtQuick.Controls Window { width: 320
height: 200
visible: true
title: "Simple QML Application"
Column {
anchors.centerIn: parent
spacing: 20
Label {
id: statusLabel
text: "Hello, QML World!"
font.pointSize: 16
anchors.horizontalCenter: parent.horizontalCenter
}
Button {
text: "Click Me"
anchors.horizontalCenter: parent.horizontalCenter
// Handle click event inline
onClicked: {
statusLabel.text = "You clicked the QML button!"
}
}
}
}
|