B
Bob Grommes
This is more of a general compiler design question than a C# question.
Suggest you use Google and search on something like:
stack heap tutorial
.... you'll get lots of explanation.
The short answer, though, is that this is universal in all languages ... the
stack is for local variables and provides very fast access via push and pop.
The heap is for larger and/or more complex structures. The heap is slower
to access and more difficult to manage, but is ideal for arbitrary hunks of
data. In C#, reference types (object instance data) is on the heap; value
types are on the stack.
--Bob
Suggest you use Google and search on something like:
stack heap tutorial
.... you'll get lots of explanation.
The short answer, though, is that this is universal in all languages ... the
stack is for local variables and provides very fast access via push and pop.
The heap is for larger and/or more complex structures. The heap is slower
to access and more difficult to manage, but is ideal for arbitrary hunks of
data. In C#, reference types (object instance data) is on the heap; value
types are on the stack.
--Bob