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. Qt memory, delete operator [SOLVED]

Qt memory, delete operator [SOLVED]

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 2.0k 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.
  • I Offline
    I Offline
    inspired
    wrote on last edited by
    #1

    currently i think there are no memory leaks in my code.
    Th program is using qgraphicsscene and a ton of qgraphicsitems (i tried a couple of qdebugs in the destructors of the graphics items and everything seems to go away when i decide to)

    however in the windows process manager the memory of the application does NOT seem to ever go down..

    even when i just create man items and then delete them all, again in the process explorer the used memory does not seem to go down!

    1 Reply Last reply
    0
    • T Offline
      T Offline
      twsimpson
      wrote on last edited by
      #2

      That could be because the "freed" memory is just put back into a memory pool, ready for allocation. Getting memory from the operating system can be costly, so many implementations don't give that memory back to the operating system instantly.
      It's hard to say if that's what's actually going on, but it's a possible explanation.

      1 Reply Last reply
      0
      • I Offline
        I Offline
        inspired
        wrote on last edited by
        #3

        so any solution?

        "http://doc.qt.nokia.com/4.7-snapshot/qt-performance.html#alternative-memory-allocation":http://doc.qt.nokia.com/4.7-snapshot/qt-performance.html#alternative-memory-allocation

        would overloading new and using malloc as stated in the article help?

        1 Reply Last reply
        0
        • K Offline
          K Offline
          koahnig
          wrote on last edited by
          #4

          As already described by Terence it could be the OS management respectively some internal logic avoiding too many costly allocation and deallocations. In addition the process manager may have also some delay in showing the effects of deallocating memory.

          Certainly you can overwrite the new operator and do all yourself, but the question is, if it is helping at the end.

          If you are not sure that this might be memory leak you can allocate and free for instance in a loop and see, if the memory will be reused. If you have a memory leak, the memory consumption will increase every time until no memory is left.

          Vote the answer(s) that helped you to solve your issue(s)

          1 Reply Last reply
          0
          • I Offline
            I Offline
            inspired
            wrote on last edited by
            #5

            thank you for your answers,
            will try a loop and see...

            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