Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Memory leak problem
Qt 6.11 is out! See what's new in the release blog

Memory leak problem

Scheduled Pinned Locked Moved Unsolved General and Desktop
15 Posts 4 Posters 5.5k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? A Former User

    @Wieland Do you need example code to generate the memory growth?

    ? Offline
    ? Offline
    A Former User
    wrote on last edited by A Former User
    #4

    @Q139 Yes, that would be really helpful :-)

    Edit: You can add a comment to QTBUG-17151, attach the source file that reproduces the error, give information about your platform & Qt version and say you request the issue to be reopened.

    ? 1 Reply Last reply
    0
    • ? A Former User

      @Q139 Yes, that would be really helpful :-)

      Edit: You can add a comment to QTBUG-17151, attach the source file that reproduces the error, give information about your platform & Qt version and say you request the issue to be reopened.

      ? Offline
      ? Offline
      A Former User
      wrote on last edited by A Former User
      #5

      @Wieland If create QTimer with 1ms or 0ms and run code below it should grow memory fast.

      Platfrom : win 7 x64
      Qt version : 5.7
      Problem occurs in mingw & msvc2013 compilers

      ui->xx->setStyleSheet("background-color: black"); // Problem occurs on this line if the ui component is dragged near QDateTimeEdit.

      Onto xx needs to be dragged a QDateTimeEdit that intersects , otherwise the growth wont begin.

      If it is normal and setStyleSheet for one time use or what to use instead if changing color of ui?

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #6

        How do you measure the memory consumption? With Valgrind?

        ? 1 Reply Last reply
        0
        • ? A Former User

          How do you measure the memory consumption? With Valgrind?

          ? Offline
          ? Offline
          A Former User
          wrote on last edited by A Former User
          #7

          @Wieland With windows task manager , no advanced debugging.
          If loop it fast, it grows fast.
          If comment out the line containing setStyleSheet and do same loop the memory stays stable.

          1 Reply Last reply
          0
          • ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #8

            Sry, didn't know Valgrind isn't available on Windows. If it's really a memory leak then there's probably nothing you can do about it right now. Do you need to change the stylesheet only for a single kind of widget or for many? If it's only one simple widget class (e.g. buttons showing some text), then you could work around it by reimplementing the paint event handler.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #9

              Hi,

              To add to @Wieland, you could also use a property to select the color and only set the stylesheet once.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • ? Offline
                ? Offline
                A Former User
                wrote on last edited by A Former User
                #10

                It was hard to reconstruct the problem on empty project , the growth was only happening if pushbutton and qdatetimeedit standing on eachother and also the mainwindow needs to have gradient background color.
                If one of the conditions not met, the growth wont appear.
                The problem may not be fully related to the old bug.

                thamT 1 Reply Last reply
                0
                • ? A Former User

                  It was hard to reconstruct the problem on empty project , the growth was only happening if pushbutton and qdatetimeedit standing on eachother and also the mainwindow needs to have gradient background color.
                  If one of the conditions not met, the growth wont appear.
                  The problem may not be fully related to the old bug.

                  thamT Offline
                  thamT Offline
                  tham
                  wrote on last edited by
                  #11

                  @Q139 It is possible to create a minimum project which could reproduce the problem and open an issue on bug tracker?

                  1 Reply Last reply
                  0
                  • ? Offline
                    ? Offline
                    A Former User
                    wrote on last edited by
                    #12

                    https://bugreports.qt.io/browse/QTBUG-56492

                    1 Reply Last reply
                    1
                    • ? Offline
                      ? Offline
                      A Former User
                      wrote on last edited by A Former User
                      #13

                      Is this not considered a memory leak or problem?
                      Why is it happening?

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #14

                        Like Thiago wrote, you are creating an application that doesn't run in normal conditions thus you might be artificially creating the problem. Like trying to refresh a UI at 200Hz and stating that it doesn't work is invalid because no system is that fast.

                        You need to provide an application sample that runs in normal condition and shows the growth, even if it's very slow. Measure it and tell when it happen, even if it's after several hours, that is not a problem.

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        0
                        • ? Offline
                          ? Offline
                          A Former User
                          wrote on last edited by A Former User
                          #15

                          Everyone can choose the timing for refresh as they like, Tested with slow rate and overnight also, it does not appear to reduce the effect noticably.

                          Since modern pcs have lots of ram it is not too critical but still strange.
                          If remove gradiant background or move one ui component away from other , the problem magically dissapears completely.
                          Also in sanity version made buttons to change those parameters automatically so it can be seen on runtime.

                          1 Reply Last reply
                          1

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved