Christopher Pisz
Christopher Pisz

Reputation: 4000

Visual Studio Diagnostics - Memory usage Snapshot shows 0 Allocations

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?

Upvotes: 6

Views: 2103

Answers (1)

cingelvladimir
cingelvladimir

Reputation: 51

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 :-)

Upvotes: 5

Related Questions