Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-1321

Assigning QtCore.Property to Python variable leaks memory

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.15.1
    • 5.14.2
    • PySide
    • None
    • Linux/X11
    • 76d5ddebc281543294a330da3e56feea080581bb (pyside/pyside-setup/5.14)

    Description

      Assigning QtCore.Property to Python variable leaks memory.

      If TestObject which inherits QtCore.QObject has the following 'number' Property,

      @QtCore.Property(int, notify=numberChanged)
      def number(self):
      return self.GetNumber()

      Calling the property from Python leaks memory even though it does not leak if it is referred from QML nor if self.GetNumber() called directly.

      To be more precise, if obj = TestObject(), it behaves like below.

      temp0 = obj.number # This leaks (~1MB/cpusec)
      #temp1 = getattr(obj,'number') # This leaks (~1MB/cpusec)
      #temp2 = obj.GetNumber() # This does not leak

      I attached a minimum script to reproduce.

      Attachments

        1. pyside1321_minimum.py
          1 kB
        2. pyside1321_noquick.py
          1 kB
        3. pyside1321_valgrind.txt
          675 kB
        4. pyside1321.zip
          1 kB
        5. test.zip
          0.9 kB

        Issue Links

          For Gerrit Dashboard: PYSIDE-1321
          # Subject Branch Project Status CR V

          Activity

            People

              kleint Friedemann Kleint
              tohge Norihito Tohge
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes