C#的大型物体和堆 [英] C# Large objects and heap

查看:110
本文介绍了C#的大型物体和堆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有点困惑大对象堆内的存储。像什么尺寸对象cosidered大?什么类型的更可能被视为大型对象?有没有适于管理这些对象任何明确的碎片的方法。

I am a bit confused about the storage of large objects within the heap.. Like at what size is the object cosidered large? What types are more likely to be treated as large objects?is there any clear fragmentation methods adapted to manage such objects.

推荐答案

< A HREF =http://msdn.microsoft.com/en-us/magazine/cc534993.aspx>这篇文章有很多细节,但你应该知道的changes进来.NET 4.5

This article has a lot of details, although you should be aware of changes coming in .NET 4.5 too.

唯一的类型而有可能最终对LOH是字符串和数组 - 因为他们基本上能够在执行时被赋予的大小的唯一类型。我不知道它甚至的有效的创造这么多字段的类型,这将结束对LOH作为单个对象 - 它可能是,但我无法想象它的发生现实。

The only types which are likely to end up on the LOH are strings and arrays - because they're the only types which can basically be given a size at execution time. I'm not sure it's even valid to create a type with so many fields that it would end up on the LOH as a single object - it may well be, but I can't imagine it happening in reality.

据链接的文章,该限制是当前85000字节。这是一个实现细节,虽然真的 - 你应该很少需要考虑一下。

According to the linked article, the limit is currently 85,000 bytes. It's an implementation detail really though - you should rarely need to think about it.

这篇关于C#的大型物体和堆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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