.NET: Monitoring Objects Lifetime (birth / death / memory)

Problem:. What is the best way to have a comprehensive view of using the roles / death / memory of ALL objects created during the lifetime of an application? (graphical report will be better)

Why such a question: Among many others, the idea is to identify long-lived objects that can never be collected by the garbage collector or cause memory problems (such as heap / stack problems or so on) and provide valuable information for effective life management object loops

(I actually just spent the whole night debugging a multi-threaded application to finally notice that the “considered remote / updated” object was actually still alive and crashed the server’s memory.)

VS2010 Performance Wizard and Profiler can be a good starter ... I came across several ways to do this programmatically, but it included wrapping objects individually (painstaking rather than seamless code)

I am looking for something similar to this:

Application START[-----------------------------------------------------------]END Object 1 [---------------------------] Object 2 [---------------------------] Object 3 [-----------------------------------------------------] 
+4
source share
2 answers

Mika,

As you noted, you can use Profiler VS2010 (if you have Visual Studio Premium or Ultimate). For more information, see the MSDN page on collecting information about a Lifetime object.

Remember that this profiling mode is quite difficult compared to other profiling modes, and you may find that the compiled VSP file is large enough if you do not have a sufficiently concentrated script that you are profiling.

The profiling report will display the information in tabular form, but you can copy the data to Excel or another program of your choice for further analysis / mapping.

Disclaimer: I am working on a Visual Studio profiler.

+2
source

There are several tools that can do this, but not as easy as a schedule. You will need to learn a little about these tools.

Free: CLR Profiler http://msdn.microsoft.com/en-us/library/ff650691.aspx

WinDbg: http://www.microsoft.com/whdc/devtools/debugging/default.mspx

Use the SOS or SOSEX extension with Windbg for the .NET profile.

Commercial: Red Gate Ants Profiler: http://www.red-gate.com/products/dotnet-development/ants-performance-profiler/

+1
source

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


All Articles