Important: Please read the Qt Code of Conduct -

[SOLVED]QProcess get RAM usage of a program

  • Hi!

    I'm looking for a way how to get memory (RAM) consumption of a program started by QProcess.
    Unfortunately I haven't found anything in documentation. Can somebody please tell me how, or at least point me in the right direction.

    Thanks in advance.

  • Determining the memory usage of an application is not supported by Qt API. What's more, it is difficult to do in general. What do you count as the memory usage of an application? Many applications use shared libraries, that are only loaded once. Still, these libraries are counted with the application RAM usage, if you take a naive approach. OTOH, if such a library is only used by a single application, what do you count? How about applications that have multiple running instances?

  • Looks like I'll have some fun using preprocessor directives for writing cross platform function.

    As memory usage, I mean amount of RAM used, like it's shown in Task Manager or top command in linux/unix OS. Application will be strict C/C++ programs without any threads, external libraries and "system()" functions. And I assume, that on every OS standard C/C++ libraries are constantly kept on RAM, so I can overlook that.

    Thanks for helping!


Log in to reply