Is it possible to know how many objects of a type are loaded in Visual Studio 2013
Asked Answered
H

1

7

I would like to know if while debugging, is possible to know how many objects of a type are loaded using a Visual Studio 2013. I am currently developing in C#.

Homopolar answered 14/12, 2013 at 13:24 Comment(2)
What do you mean by how many objects are loaded? You might add some debug code to your object's constructor/finalizer that counts them in a static field. Like here: #2392575Sheffie
what's up with all the downvotes?Urbano
P
8

It depends on the edition of Visual Studio you're using whether there's native support for this with a nice GUI. The .NET Memory Allocation Profiler can help you view the number of objects in memory, it ships with Visual Studio Premium and Ultimate. You can also use a more hard-core technique using Sons-of-Strike, which can give you very detailed information, should you know what to look for. SoS works with any version of Visual Studio and even with the basic WinDbg debugger. Here's an additional tutorial from the Microsoft P&P group on the subject. To get SoS you need to download and install the Windows Debugging Tools whcih you can find here.

There are a number of 3rd party profilers as well, like:

Other similar questions on StackOverflow:

Premium answered 14/12, 2013 at 13:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.