How do I get the reference count for a managed object?

.NET profilers can show the number of references to managed objects. How do they count them?

+2


source to share


1 answer


They use unmanaged APIs that provide access to the profiler.

ICorProfilerCallback and ICorProfilerCallback2 are the main ones.These are the interfaces that use .NET profilers. There are a few more links like this .



You can use class loading (ClassLoadFinished ()) and unloading (ClassUnloadFinished ()) methods to keep track of this information.

+4


source







All Articles