.NET profilers can show reference count to managed objects. How do they count them?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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.