The PROCESS_MEMORY_COUNTERS struct returned by GetProcessMemoryInfo contains several values relative to the peak memory usage from the start of the process.
Is it possible to use other functions to collect similar information in a specified time period (and not for the entire lifetime of the process)?
I can think of two ways but both are imperfect:
- Run a thread that calls
GetProcessMemoryInfo
repeatedly. This will give approximate results but might miss very transient allocations-deallocations between two calls. - Use InitializeProcessForWsWatch, call GetWsChanges and sum the memory of all the pages that have been added... but where are the pages that are no longer used? And what is the impact on performance?