今天看啥
热点:

SOS是VS提供的内存监测工具,可以在调试时实时监测内存数据。

在使用SOS之前,首先要了解几个常用的调试概念。

托管代码与非托管代码:

Managed Code:

Managed code is code written in one of over twenty high-level programming languages that are available for use with the Microsoft .NET Framework, including C#, J#, Microsoft Visual Basic .NET, Microsoft JScript .NET, and C++. All of these languages share a unified set of class libraries and can be encoded into an Intermediate Language (IL). A runtime-aware compiler compiles the IL into native executable code within a managed execution environment that ensures type safety, array bound and index checking, exception handling, and garbage collection.

常见的托管代码有:

1. Code that is executed by the CLR.
2. Code that targets the common language runtime, the foundation of the .NET Framework, is known as managed code.
3. Managed code supplies the metadata necessary for the CLR to provide services such as memory management, cross-language integration, code access security, and 4. 4. automatic lifetime control of objects. All code based on IL executes as managed code.
Code that executes under the CLI execution environment.

托管调试: Managed Debugging

仅对托管代码进行调试称为托管调试。

SOS 命令

!load SOS: 启动SOS。仅仅执行托管调试时不能载入SOS。解决办法是在 项目-->属性-->调试 页面打开启用非托管代码调试。加上断点,Debug

!CLRStack -n

!DumpDomain

!DumpObj

!DumpHeap -type className

!DumpMT

!u methodAddress

www.bkjia.comtruehttp://www.bkjia.com/xtzh/746240.htmlTechArticleSOS是VS提供的内存监测工具,可以在调试时实时监测内存数据。 在使用SOS之前,首先要了解几个常用的调试概念。 托管代码与非托管代码:...

相关文章

帮客评论

视觉看点