XSLT存档  

不及格的程序员-八神

 查看分类:  ASP.NET XML/XSLT JavaScripT   我的MSN空间Blog

Deleaker is ready for Visual Studio 2022!

Since Microsoft announced the first preview of Visual Studio 2022, we have been frequently asked to support the new version of the IDE. Today we are excited to announce the availability of the Deleaker update that comes with the full support of the latest Visual Studio 2022.

It is never too late to support 64-bit.

A famous Chinese proverb says: “The best time to plant a tree was 20 years ago. The second best time is now.” Speaking about software, a developer can say: “The best time to add a 64-bit version of the software was 16 years ago. The second best time is now.” For Visual Studio, now is November 8, 2021.

Let’s remind you in a few words the story of moving Windows from 32-bit to 64-bit. Sixteen years ago, in 2005, the first 64-bit Windows version was released. The new Windows 11, released in 2021, is the first version that dropped support for 32-bit hardware.

What about Visual Studio? In 1997, the very first version (of course, it was 32-bit) was launched. For the next 23 years, Visual Studio was 32-bit as well. And finally, Microsoft is releasing the first 64-bit version of Visual Studio 2022 on November 8, 2021. Why did Microsoft linger? Nobody knows, but it is not surprising: let’s look at another cross-platform IDE, Qt Creator. The first 64-bit version was released about one year ago, at the end of 2020.

How does Deleaker help find leaks?

Deleaker is a runtime leak detector that works as a standalone tool and plugin in powerful IDEs, including Visual Studio. Thanks to the cooperation with the standard Visual Studio debugger, Deleaker collects information about allocations and deallocations efficiently. Hence, a process is almost not slowing down even if it makes billions of allocations.

Let’s look at how to utilize Deleaker with the help of a sample code that has several intentional leaks. Download the installer and run it. If Visual Studio 2022 is installed on the machine, the installer offers to add the Deleaker extension:

The Deleaker installer is ready for Visual Studio 2022

After installation, launch Visual Studio 2022, click to Extensions. You will see the Deleaker menu. If it is disabled, click to Extensions – Deleaker – Enable Deleaker:

Enable Deleaker in Visual Studio 2022

Create a simple console application and introduce an intentional leak to check how Deleaker finds leaks. Then start debugging. After the process exits, Deleaker takes the final snapshot. The leak is displayed. Select Show Source Code from the context menu to navigate to the source code:

Deleaker displays memory leak

Deleaker catches a lot of leak types, including handles leaks. Let’s add the CreateProcess call, but “forget” to close the returned process and thread handles. The final snapshot contains two handles, as expected:

Deleaker has found handles leaks

What’s next?

There is a comprehensive tutorial on how to fix leaks in C++ without leaving Visual Studio. Prefer video? We have recorded one for you to show how Deleaker can be used while debugging leaks in Visual Studio.

 
posted on 2023-02-26 13:10  不及格的程序员-八神  阅读(153)  评论(0编辑  收藏  举报