- In value type based variables holds memory on stack and hold fixed space for example integer in dot net hold 4 bytes.
- In reference type based variables holds memory at managed heap. Reference type variables hold dynamic space. The space hold by reference type can be vary.
When reference is to assign to variable. Only reference is stored in variable. Where this reference is refer actual memory is stored in heap where actual value or data is placed.
Stack is small area of memory where fixed no of space is reserved . for example integer , double always contain same area of memory. So they placed in stack.
While heap is dynamic memory where variable for example string can hold 2 bytes or it contain all available of physical memory .