📜 ⬆️ ⬇️

Out-of-Process Debugger for C ++ in Visual Studio 2019

Visual Studio 2019 Preview 1 introduces an improved debugger for C ++ that uses an external 64-bit process to allocate its resource-intensive components. If you have previously had memory problems when debugging C ++ applications, these problems should now be largely resolved using Visual Studio 2019.

Below is a practical example of debugging Gears of War 4.


')

Prerequisites


When giving feedback, C ++ developers often talked about the problems associated with high memory usage while debugging complex C ++ applications. Large memory consumption is associated with a huge amount of symbol data, which the debugger should load and show in the debugger window. Moreover, the volume of this information while working all the time is growing. Ultimately, the Visual Studio process may fail due to insufficient memory.

We have made significant improvements in Visual Studio 2017 to mitigate this problem. For example, in update 15.6, memory optimization for / Debug: fastlink was introduced, which resulted in a 30% reduction in memory consumption by the debugger. Since we are trying to avoid this problem in Visual Studio 2019, we moved components with memory usage to a separate 64-bit process.

Example from practice: Debugging Gears of War 4


We worked closely with internal and external partner teams to ensure that the changes we made to the debugger were tested and validated in large real-world applications. Below we have duplicated the video from cdpv. It shows a parallel comparison of memory usage between Visual Studio 2017 and Visual Studio 2019 when debugging Gears of War 4, developed by The Coalition. The memory usage of Visual Studio 2017 increases to 1.3 GB after several minutes of viewing the game code and checking variables. Visual Studio 2019 provides much better memory usage in the same scenario: the amount of memory used remains at around 285 MB, since symbol data is stored in the 64-bit debugger workflow.



At runtime, everything now works much better too.

Unsupported Scripts and Some Known Issues



If you need to continue using the in-process debugger, you can disable the feature by going to the “Debugging” tab in “Tools” -> “Options” and unchecking the “Load debug symbols for external process” (native only) box.



The guys from the Microsoft Developer Community @msdevru, the Microsoft Developer community channel for developers and anyone interested in new technologies helped us prepare this article.

Source: https://habr.com/ru/post/433992/


All Articles