Can't take native memory snapshots in Visual Studio 2017 Diagnostic Tools
Asked Answered
M

1

5

I'm writing a C# application with Visual Studio 2017 Community. I have an issue with a memory leak, presumably having something to do with me misusing one DLL that allocates things on the native heap. I'd like to find out how I'm causing the DLL to keep allocating lots of memory.

Diagnostic Tools seems like an ideal tool for the job, with its memory snapshot capability. Unfortunately, memory snapshots give information on managed heap only, which is perfectly stable in my case.

I tried going to Diagnostic Tools settings -> Memory Profiler Tool -> Configuration -> Enable native heap profiling with snapshots before running the debugger, but I still only get managed heap information in my snapshots.

I tried launching the debugger without enabling native heap profiling, breaking, and only then enabling native heap profiling. If I try to take a snapshot then, Diagnostic Tools gets stuck with a Taking snapshot... progress bar.

Anyone had similar issues?

Mitzvah answered 12/9, 2017 at 7:19 Comment(0)
M
7

Finally figured it out. Of course, you need to enable native debugging for your project:

Project properties -> Debug -> Enable native code debugging

Mitzvah answered 12/9, 2017 at 9:19 Comment(1)
Exactly, right click the project, Properties -> debugging -> debugger type -> Native only.Tattan

© 2022 - 2024 — McMap. All rights reserved.