Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Large Objects

I remember reading that objects over a certain size (85k) are placed in a
separate section of the heap in order to insure that the objects are not
collected. Which leads me to the following questions.

1. Is this true?
2. Is so, is 85k the size?
3. If I declare an array of a user-defined class that exceeds 85k, does this
guarantee me that class along with all fields (int, byte, string, etc) will
be placed in the special heap were they are not collected?

Thanks,
Humberto
[519 byte] By [Humberto Morales] at [2007-11-9 18:50:25]
# 1 Re: Large Objects
Hello Humberto,

> I remember reading that objects over a certain size (85k) are
> placed in a separate section of the heap in order to insure

> 1. Is this true?

Yes.

> 2. Is so, is 85k the size?

No. It is 20k.

> 3. If I declare an array of a user-defined class that exceeds
> 85k, does this guarantee me that class along with all fields
> (int, byte, string, etc) will be placed in the special heap
> were they are not collected?

No. The '20k and larger' heap is also garbage collected. Also, if
you created an ArrayList, and added five objects to it (two of them
larger than 20k, the other three smaller) then you will have created a
total of six objects, only two of which would be placed in the '20k and
larger' heap. Adding an item to an ArrayList does not make the
ArrayList 'larger'... it would simply contain another 'pointer' to the
added object.

Here is a link to an MSDN article that explains this stuff WAYYYY
better than I ever could:

http://msdn.microsoft.com/msdnmag/issues/1100/GCI/default.aspx

Hope this helps,
Len
Len Weaver at 2007-11-11 21:58:05 >