Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Memory Usage after object.destroy

Memory Usage after object.destroy

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
6 Posts 4 Posters 807 Views
  • 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.
  • dheerendraD Offline
    dheerendraD Offline
    dheerendra
    Qt Champions 2022
    wrote on last edited by
    #1

    Hi

    I created object dynamically in QML. When object is created memory usage increases. When I object is deleted using object.destroy, I don't see memory usage is getting decreased.

    1. Memory usage remains the same as before delete. Any idea why ?

    Tried this on MAC with Qt 5.5. and 5.7. Same result.

    Dheerendra
    @Community Service
    Certified Qt Specialist
    http://www.pthinks.com

    1 Reply Last reply
    2
    • M Offline
      M Offline
      Mowlee
      wrote on last edited by
      #2

      Hi ,

      Im also facing similar issue.
      Any update is there on this topic?

      Regards
      Mowlee

      JonBJ 1 Reply Last reply
      0
      • M Mowlee

        Hi ,

        Im also facing similar issue.
        Any update is there on this topic?

        Regards
        Mowlee

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by
        #3

        @Mowlee , @dheerendra
        How are you two measuring the "memory usage" here?

        If you are using some tool which shows the overall memory usage of your process, be aware that it is extremely likely that freed memory from an application will remain in its memory allocation awaiting re-use in future allocations. For example, if it ultimately uses something like malloc() to get its memory that maintains its own table of blocks in use & blocks no longer used but available for re-use. To "hand memory back to the OS" requires calling something like brk(), and that only works if the memory to be returned is at the top of the allocated area; I would doubt Qt will call this.

        So if you really want to know how much memory is actually in use/free for reallocation you will need to use a dedicated tool to walk the heap/handles within the process, not just ps or taskman.

        1 Reply Last reply
        1
        • M Offline
          M Offline
          Mowlee
          wrote on last edited by
          #4

          @JonB
          Thank you for reply.

          I didnt use any tool for memory usage. But my issue looks similar to @dheerendra 's issue.

          1. I have created a object.
          2. At this time children length of object is 1 [object.parent.children.length]
          3. Destroyed that and created another object.
          4. At this point, the children length of the object is 2[object.parent.children.length]

          After destroying the object(object.destroy()), do we need to use any other call to clear memory?

          Regards
          Mowlee

          J.HilkJ 1 Reply Last reply
          0
          • M Mowlee

            @JonB
            Thank you for reply.

            I didnt use any tool for memory usage. But my issue looks similar to @dheerendra 's issue.

            1. I have created a object.
            2. At this time children length of object is 1 [object.parent.children.length]
            3. Destroyed that and created another object.
            4. At this point, the children length of the object is 2[object.parent.children.length]

            After destroying the object(object.destroy()), do we need to use any other call to clear memory?

            Regards
            Mowlee

            J.HilkJ Online
            J.HilkJ Online
            J.Hilk
            Moderators
            wrote on last edited by
            #5

            @Mowlee you can call gc() to force the garbage collector to run, if it helps.


            Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


            Q: What's that?
            A: It's blue light.
            Q: What does it do?
            A: It turns blue.

            1 Reply Last reply
            0
            • M Offline
              M Offline
              Mowlee
              wrote on last edited by Mowlee
              #6

              @J-Hilk

              After object.destroy(), called gc(). I am seeing still the issue is not resolved.

              Regards
              Mowlee

              1 Reply Last reply
              0

              • Login

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