In other words if the value type is part of the state of a reference type it gets allocated on the managed pile ... sorry heap ... inline with the rest of that object's state.
e.g.
struct Point
{
int x;
int y;
}
class Line
{
Point start;
Point end;
}
The memorry for the Point instances will be allocated on the managed heap when a line instance is created.
Regards
Richard Blewett - DevelopMentor
http://staff.develop.com/richardb/weblog
nntp://news.microsoft.com/microsoft.public.dotnet.languages.csharp/<MP************************@msnews.microsoft.com >
Robbie <Ro************@netscape.net> wrote:
Someone at work asked me this question:
Value types--do they hit the heap or the pile? Well, I was a bit
dumbfounded, because I never heard of the term "pile". I've heard of
heap and stack, but what is a pile? Is it just another name for
stack? Doing some reading, I found that value types use stack memory
since the size can be determined at compile time and there's less
overhead with this type of memory. So, I'm thinking this is just
another name for stack. I couldn't find "pile" defined in
webopaedia.com.
I haven't heard of "pile" either, to be honest.
Value types reside on the stack if they come from:
o Local variables
o Intermediate expressions (i.e. evaluation on the stack)
o Instance variables where the enclosing value is also on the stack
See
http://www.pobox.com/~skeet/csharp/memory.html for more
information.
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (
http://www.grisoft.com).
Version: 6.0.760 / Virus Database: 509 - Release Date: 10/09/2004
[microsoft.public.dotnet.languages.csharp]