其中管理类的.NET Framework分配(或使用)非托管内存? [英] Which managed classes in .NET Framework allocate (or use) unmanaged memory?

查看:222
本文介绍了其中管理类的.NET Framework分配(或使用)非托管内存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否存在已知的(记录)的.NET类型,在进程的内存中的非托管部分?

Is there a known (documented) set of .NET types that allocate memory in the unmanaged portion of the process' memory?

例如,该WPF基础设施,以便分配的非托管内存为它保留的渲染模型微软的文档来优化性能。是否有.NET framework的,利用大量的非托管内存等其他部分?

For example, Microsoft documents that the WPF infrastructure allocated unmanaged memory for its retained rendering model in order to optimize performance. Are there other such portions of the .NET framework that utilize large amounts of unmanaged memory?

推荐答案

如果它实现的IDisposable 有一个非常好的机会,它拥有的非托管数据,或者它拥有一个管理类,最终拥有非托管数据。如果有的Finalize(),它的标志,它直接拥有的非托管数据。

If it implements IDisposable there is a very good chance it owns unmanaged data, or it's owning a managed class that ultimately owns unmanaged data. If it has Finalize(), it's sign that it directly owns unmanaged data.

作为一个经验法则,如果它实现的IDisposable ,然后的Dispose()只要你是大功告成。

As a rule of thumb, if it implements IDisposable, then Dispose() it as soon as you're done.

这篇关于其中管理类的.NET Framework分配(或使用)非托管内存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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