Articles → .NET → Stack And Heap

Stack And Heap





  1. What is stack?
  2. What is heap?




  1. Name
  2. Data type
  3. Value


Picture showing how variable stores data in the memory

Click to Enlarge




Stack




Picture showing the pictorical representation of stack

Click to Enlarge



function MyFunction() {
  int arg1 = 5;
  int arg2 = 6;
}




Picture showing how the data is stored in the stack

Click to Enlarge



  1. Value types (that holds memory and data on same location) are stored in stack.
  2. Stack is fixed sized.
  3. Stack only contains the variables of those functions that are running.

Heap




Picture showing how the data is stored in the heap

Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Monday, May 4, 2015

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250