I am trying to find out how much memory my application is consuming from within the program itself. The memory usage I am looking for is the number reported in the ‘Mem Usage’ column on the Processes tab of Windows Task Manager.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A good starting point would be GetProcessMemoryInfo, which reports various memory info about the specified process. You can pass
GetCurrentProcess()as the process handle in order to get information about the calling process.Probably the
WorkingSetSizemember ofPROCESS_MEMORY_COUNTERSis the closest match to the Mem Usage coulmn in task manager, but it’s not going to be exactly the same. I would experiment with the different values to find the one that’s closest to your needs.