什么是固定的对象? [英] What are pinned objects?

查看:112
本文介绍了什么是固定的对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找到利用蚂蚁内存分析器内存泄漏,我已经在一个新名词遇到的:

I am trying to find a memory leak using ants memory profiler, and I've encountered in a new term:

固定的对象。

有一个人可以给我一个很好的&安培;什么这个对象是简单的解释,我PINN / Unpinn对象,以及如何可以检测谁固定的对象?

Can some one give me a good & simple explanation about what this objects are, How can I pinn/Unpinn objects, and detect who pinned objects?

感谢

推荐答案

一个固定对象是一个不允许移动。垃圾收集器通常在压实存储器,它移动的所有对象中对一个或多个集群。这是创造的自由空间大块。

A pinned object is one that is not allowed to move. The garbage collector is normally compacting the memory in that it moves all objects to "one or more clusters". This is to create large chunks of free space.

此基本上意味着如果别人(外)具有一个指针的对象的存储器地址,这可能指向随机内容 - 作为对象已经移动

This basically means if someone else (outside) has a pointer to the memory address of an object, this may point to random content - as the object has moved.

钉住对象告诉GC以不动它。这通常是没用的,并与指针时才有意义 - 使用的PInvoke时等。有时候你需要在地址转向一个结构(在内存布局项),如果是在类中实现,你必须针这一点。

Pinning an object tells the GC to NOT MOVE IT. This is normally useless and ONLY makes sense when working with pointers - like when using PInvoke. Sometimes you need to turn in an address to a structure (in the memory layout term), and if that is implemented in a class, you have to pin that.

要回答具体的:


  • 您不能找出谁钉的obiect。

  • 钢钉与固定语句来完成的。这是只允许在不安全code。

检查:

<一个href=\"http://msdn.microsoft.com/en-us/library/f58wzh21%28VS.80%29.aspx\">http://msdn.microsoft.com/en-us/library/f58wzh21%28VS.80%29.aspx

这篇关于什么是固定的对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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