[PyQt] Attempting to reduce the memory footprint of my PyQt5 application

Xavion xavion.0 at gmail.com
Tue Sep 6 05:22:29 BST 2016


Hi All,

I'm trying to cut down on the memory usage of my PyQt5 application.  I'm
assuming that one way to do this is to only import the Qt submodules that
are actually used.

The three attached files illustrate my point.  The Qt5 Designer only
imports the necessary submodules (e.g. "QtCore/QVariant").  Whereas, the
PyQt5 UIC and RCC generators import the parent modules in full (e.g.
"QtCore").

Assuming my memory reduction theory is right, is there any way that I can
get the UIC and RCC generators to behave like the Qt5 Designer?  There's
probably no point in using this strategy throughout the rest of my code if
not.


-- 
Regards, Xavion.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20160906/e94db0fd/attachment.html>
-------------- next part --------------
/********************************************************************************
** Form generated from reading UI file 'MainSL4394.ui'
**
** Created by: Qt User Interface Compiler version 5.7.0
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/

#ifndef MAINSL4394_H
#define MAINSL4394_H

#include <QtCore/QVariant>
#include <QtWidgets/QAction>
#include <QtWidgets/QApplication>
#include <QtWidgets/QButtonGroup>
#include <QtWidgets/QFrame>
#include <QtWidgets/QGridLayout>
#include <QtWidgets/QHBoxLayout>
#include <QtWidgets/QHeaderView>
#include <QtWidgets/QLabel>
#include <QtWidgets/QMainWindow>
#include <QtWidgets/QMenu>
#include <QtWidgets/QMenuBar>
#include <QtWidgets/QPushButton>
#include <QtWidgets/QSpacerItem>
#include <QtWidgets/QStatusBar>
#include <QtWidgets/QTreeWidget>
#include <QtWidgets/QWidget>

...
-------------- next part --------------
# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file '../Source/Main.ui'
#
# Created by: PyQt5 UI code generator 5.7
#
# WARNING! All changes made in this file will be lost!

from PyQt5 import QtCore, QtGui, QtWidgets

...
-------------- next part --------------
# -*- coding: utf-8 -*-

# Resource object code
#
# Created by: The Resource Compiler for PyQt5 (Qt v5.7.0)
#
# WARNING! All changes made in this file will be lost!

from PyQt5 import QtCore

...


More information about the PyQt mailing list