Skip to content

Instantly share code, notes, and snippets.

@durden
Created February 14, 2013 21:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save durden/4956774 to your computer and use it in GitHub Desktop.
Save durden/4956774 to your computer and use it in GitHub Desktop.
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