Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Script to see the memory usage of each individual PyQt4 module.
"""
Script to see the memory usage of each individual PyQt4 module.
Meant to be run with the memory_profiler:
- http://pypi.python.org/pypi/memory_profiler
Usage: python -m memory_profiler qt_memory_usage.py
"""
@profile
def import_qt_module_by_module():
"""
Comment/uncomment lines and re-run profiling to see memory impact of each
module. You will get ImportErrors for optional modules you don't have
installed like QtDBus, etc. Feel free to comment out any lines that lead
to ImportErrors to get accurate numbers for your own setup.
"""
from PyQt4 import QtCore
from PyQt4 import QtDBus
from PyQt4 import QtDeclarative
from PyQt4 import QtGui
from PyQt4 import QtHelp
from PyQt4 import QtMultimedia
from PyQt4 import QtNetwork
from PyQt4 import QtOpenGL
from PyQt4 import QtScript
from PyQt4 import QtScriptTools
from PyQt4 import QtSql
from PyQt4 import QtSvg
from PyQt4 import QtTest
from PyQt4 import QtWebKit
from PyQt4 import QtXml
from PyQt4 import QtXmlPatterns
from PyQt4 import phonon
from PyQt4 import QtAssitant
from PyQt4 import QtDesigner
from PyQt4 import QtAxContainer
from PyQt4 import Qt
if __name__ == "__main__":
import_qt_module_by_module()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.