Question

.NET profilers can show reference count to managed objects. How do they count them?

Was it helpful?

Solution

They use unmanaged APIs which provide access to the profiler.

ICorProfilerCallback and ICorProfilerCallback2 are the main ones. These are the the interfaces that .NET profilers use. There are some more references like this.

You can use the methods for class loads (ClassLoadFinished()) and unloads (ClassUnloadFinished()) to track this information.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top