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. Measure the overall memory usage of my application
Qt 6.11 is out! See what's new in the release blog

Measure the overall memory usage of my application

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 2.7k Views 1 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.
  • I Offline
    I Offline
    isaacEnrique
    wrote on last edited by
    #1

    Greetings.

    I want to measure the overall memory usage of my application Qt (including memory that is not created dynamically, eg, with 'new' operator ). I wonder if there is a class or object in Qt for this type of task.

    In the case of memory created dynamically, I was thinking to create two macro: one to use instead of the new operator and the other instead of delete operator, so keep track memory allocated and freed ... is this a good idea?, is there a better or simpler way to do this measurement?.

    How could I measure the memory is not created dynamically?

    Thanks in advance for any help and/or suggestions.

    Isaac Pérez
    Programming is understanding.

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

      Replacing "new" and "delete" via macro doesn't work, since it only effects your own code - but most memory allocations will probably occur indirectly inside Qt classes and other libraries that you use (not to forget the Standard C library). Instead you would need to "hook":http://en.wikipedia.org/wiki/Hooking malloc() and free().

      See also:
      "Memory Allocation Hooks":http://www.gnu.org/software/libc/manual/html_node/Hooks-for-Malloc.html

      __

      Anyway, if you just want to see the overall memory usage of your application, a standard task manager like "htop" on Linux or "Process Explorer" on Windows will do the job! And if you want a more detailed analysis, e.g. to scan for memory leaks, use a tool like "Valgrind" (Linux) or "VLD" (Windows).

      My OpenSource software at: http://muldersoft.com/

      Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS

      Go visit the coop: http://youtu.be/Jay...

      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