0

I want to get memory usage of my application (Windows, Win7, x64) from within it, programmatically. I tried using the API GetProcessMemoryInfo() but I'm not sure about the returned values.

What I would like to get are:

  • the total memory used by the app (RAM + page file)

  • the total physical memory used by the app (RAM only).

My goal is to track memory leak(s) by executing repetitive tasks from within my application and monitoring/logging the evolution of the used memory.

Note: Currently I'm using PROCESS_MEMORY_COUNTERS::PageFileUsage for total memory and PROCESS_MEMORY_COUNTERS::WorkingSetSize for the physical (RAM) memory. I think this is not the right way to get what I want.

dom_beau
  • 2,437
  • 3
  • 30
  • 59
  • not think that memory-leaks can be effective found by this. and here may be most useful be Virtual memory Size used by process (from *VM_COUNTERS*, but this member is dropped when copied to *PROCESS_MEMORY_COUNTERS* ) – RbMm Apr 06 '17 at 15:26

1 Answers1

0

I refered to this question and follow the recommendations. From PROCESS_MEMORY_COUNTERS_EX::PrivateUsage I got the same values as from PROCESS_MEMORY_COUNTERS::PageFileUsage.

I assume the solution I used and described in my question is the right one.

Community
  • 1
  • 1
dom_beau
  • 2,437
  • 3
  • 30
  • 59