views:

217

answers:

1

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

+2  A: 

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.

I would assume they use the methods for class loads (ClassLoadFinished()) and unloads (ClassUnloadFinished()) to track this information.

BrianLy