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 is Leaking but Heob don't get it?
Forum Updated to NodeBB v4.3 + New Features

Memory is Leaking but Heob don't get it?

Scheduled Pinned Locked Moved Solved General and Desktop
leak detectionheob
6 Posts 4 Posters 710 Views 2 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.
  • L Offline
    L Offline
    leonardoMB
    wrote on 20 Jun 2022, 02:36 last edited by leonardoMB
    #1

    I'm with the following problem, in my application I have some "widgets", like small windows inside the main application, that contains multiple QWidgets, for example I have a Histogram Widget with a lot of others widgets inside it. This histogram widget has its own custom .dll

    The problem is: If I create one Histogram Widget my RAM gets consumed around 10 MB, and if I close the Histogram I just get 1 MB back , but heob says that from this dll only 65KB "leaked"(I filtered all calls of heob that contains this dll in the stack) .

    The other problem is that if I close this Histogram Widget and open another, I don't use 10 MB, I use like 1MB. I'm just lost and would like some light, thans in advance

    1 Reply Last reply
    0
    • S Offline
      S Offline
      sierdzio
      Moderators
      wrote on 20 Jun 2022, 05:44 last edited by
      #2

      You are checking RAM use with some system tool like System Monitor right?

      Then this is perfectly normal. Such tools report RAM reserved for the application. So, when you open your histogram, 10 MB is requested and granted from the Operating System. When you close (delete) the widget it is properly deallocated but the Operating System will typically keep it "reserved" for the application. So the next time your app requests 0-10MB, the memory is already prepared and can be initialized immediately. The OS manages this reservation automatically and it's not under control of your application. But you can be sure it's not a big 10MB memory leak.

      So, if heob, valgrind or asan do not detect a big leak, there is no big leak. Do not worry about what system monitor shows.

      (Z(:^

      L 1 Reply Last reply 20 Jun 2022, 12:58
      3
      • S sierdzio
        20 Jun 2022, 05:44

        You are checking RAM use with some system tool like System Monitor right?

        Then this is perfectly normal. Such tools report RAM reserved for the application. So, when you open your histogram, 10 MB is requested and granted from the Operating System. When you close (delete) the widget it is properly deallocated but the Operating System will typically keep it "reserved" for the application. So the next time your app requests 0-10MB, the memory is already prepared and can be initialized immediately. The OS manages this reservation automatically and it's not under control of your application. But you can be sure it's not a big 10MB memory leak.

        So, if heob, valgrind or asan do not detect a big leak, there is no big leak. Do not worry about what system monitor shows.

        L Offline
        L Offline
        leonardoMB
        wrote on 20 Jun 2022, 12:58 last edited by
        #3

        @sierdzio Great answer, but what if RAM is a limitation for me? like: I really need that 10 MB

        J S S 3 Replies Last reply 20 Jun 2022, 13:09
        0
        • L leonardoMB
          20 Jun 2022, 12:58

          @sierdzio Great answer, but what if RAM is a limitation for me? like: I really need that 10 MB

          J Offline
          J Offline
          JonB
          wrote on 20 Jun 2022, 13:09 last edited by
          #4

          @leonardoMB What exactly would you like @sierdzio to do about this?

          1 Reply Last reply
          0
          • L leonardoMB
            20 Jun 2022, 12:58

            @sierdzio Great answer, but what if RAM is a limitation for me? like: I really need that 10 MB

            S Offline
            S Offline
            sierdzio
            Moderators
            wrote on 20 Jun 2022, 16:09 last edited by
            #5

            @leonardoMB said in Memory is Leaking but Heob don't get it?:

            @sierdzio Great answer, but what if RAM is a limitation for me? like: I really need that 10 MB

            Your OS should give this memory to other processes if necessary and if your process does not use it for some time. Systems are clever about this :-)

            (Z(:^

            1 Reply Last reply
            1
            • L leonardoMB
              20 Jun 2022, 12:58

              @sierdzio Great answer, but what if RAM is a limitation for me? like: I really need that 10 MB

              S Offline
              S Offline
              SimonSchroeder
              wrote on 22 Jun 2022, 08:42 last edited by
              #6

              @leonardoMB said in Memory is Leaking but Heob don't get it?:

              Great answer, but what if RAM is a limitation for me? like: I really need that 10 MB

              If this is really your problem, then you need to provide more information. More specifically we need your platform and operating system (my guess is embedded with a Linux system?). However, you might get better answers for these kind of problems on Stack Overflow as this is not really related to Qt anymore.

              1 Reply Last reply
              1

              1/6

              20 Jun 2022, 02:36

              • Login

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