本机代码和托管代码之间的区别? [英] Difference between native and managed code?

查看:293
本文介绍了本机代码和托管代码之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,在查看GlowCode探查器网站时,它会显示:

For example, when looking at the GlowCode profiler website it says:

"GlowCode 6.2和x64配置文件本机,托管和混合的C ++,C#、. NET代码"

"GlowCode 6.2 and x64 profile native, managed, and mixed C++, C#, .NET code"

它们是什么意思?

推荐答案

本机代码是不托管"内存的代码,例如,内存不为您释放(例如C ++的删除和C的免费) ),没有引用计数,没有垃圾收集.您猜对了,托管代码是可以释放内存并为您分配的代码,包括垃圾回收和其他功能.

Native code is the code whose memory is not "managed", as in, memory isn't freed for you (C++' delete and C's free, for instance), no reference counting, no garbage collection. Managed code, you guessed it, is the code whose memory is free and allocated for you, garbage collection and other goodies.

混合代码是指您拥有调用非托管层的托管代码.通常,当您有一个纯的非托管C ++ DLL并使用P/invoke从.NET调用时.

Mixed code is when you have managed code that calls onto an unmanaged layer. Normally, when you have a pure unmanaged C++ DLL and you call it from .NET using P/invoke.

这篇关于本机代码和托管代码之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆