首页 > 其他 > 详细

SOS 使用总结

时间:2014-03-25 17:06:30      阅读:298      评论:0      收藏:0      [点我收藏+]

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

参考连接:Drill into How CLR create Objects http://msdn.microsoft.com/en-us/magazine/cc163791.aspx

                    Son of  Strike: http://msdn.microsoft.com/en-us/library/bb190764(v=vs.110).aspx

SOS 使用总结,布布扣,bubuko.com

SOS 使用总结

原文:http://blog.csdn.net/changtianshuiyue/article/details/21275445

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!