Visual Studio Diagnostics - Memory usage Snapshot shows 0 Allocations
Asked Answered
M

1

6

I ignored this tool for a long time, because it was .NET only.

According to MSDN, the diagnostics tool works for native code, compiled in Visual Studio 2015 in Debug.

I am following: https://learn.microsoft.com/en-us/visualstudio/profiling/memory-usage

I enable 'Heap Profiling' in the 'Diagnostic Tools' window, under the 'Memory Usage' tab. I then rebuild all, making sure the toolset is 'Visual Studio 2015' for every project, and making sure PDBs are built for every project that is a dll or exe. I set a breakpoint at main, when a client connects to my process, and after that client is sent data. There are thousands of calls to new in between. Each time I click 'Take Snapshot'. When I click take snapshot, a row appears with time, Allocations, and Heap Size. The latter two are zeroed out.

If I do the same with my one of my unit tests, they are filled out and I can drill down as described in the documentation.

What should I look for to get it to work with my main project? Are there certain linking settings? Does it matter that I am building statics libs and dynamic libs? Anything specific to to look for?

Mara answered 6/11, 2017 at 16:52 Comment(0)
E
5

I've had a similar issue (the vs2015 or vs2017 showed 0 allocations on the heap). Then I've noticed I had my gflags enabled to full page heap verification (can be checked by gflags /p).

I've just disabled it and now heap snapshots started to work again :-)

Eileneeilis answered 1/6, 2018 at 11:23 Comment(1)
To clarify for anyone encountering the same issue, this can happen when using the Application Verifier, which is basically the UI for gflags. After clearing the flags in AV, heap profiling and snapshots work fine in both VS2015 and 2017.Eustacia

© 2022 - 2024 — McMap. All rights reserved.