I'm analyzing memory overhead of my C++ application. I collected a Memory Usage snapshot using Visual Studio 2019 Performance Profiler. However the snapshots contain only ~20% of memory of what is reported as Private Bytes in Diagnostics tab (or Process Explorer app).
I suspect some of the unaccounted memory is stack based memory which the heap captures wouldn't cover but I'd expect its size to be miniscule amount in comparison to heap right? The system has plenty of free RAM left (100+ GB), so I don't expect 80% of Private Bytes being in pagefile, in case the Memory Usage snapshot wouldn't capture that? Any suggestions how to understand where all the memory is (i.e. how much of it is stack based memory, etc) and or how to get a capture of it all with corresponding stacks?
For example I collected two snapshot of my app with two different memory usage amounts:
- Diagnostics tab shows 11 GB taken, Memory Usage snapshot contains only 2.07 GB
- Diagnostics tab shows 23.4 GB taken, Memory Usage snapshot contains only 3.93 GB
Left (1), Right (2)