Answers

Question and Answer:

  Home  Senior .Net Developer

⟩ Tell us what is Heap and what is Stack?

☛ Both are memory locations, wherein Heap is global and Stack is local.

☛ The Heap is application level while the Stack is thread-level.

☛ The Stack has a defined first-in-first-out stack structure, while the Heap does not have a defined data structure.

☛ Its size is defined at the time of its creation. For Heap, the size is defined when starting the application and for Stack, when creating a thread.

☛ Both can grow dynamically.

☛ The Stack is faster than the Heap. A stack is in “cache” and doesn’t have to synchronize with other threads like the Heap.

☛ The Stack stores values while the Heap stores objects.

 201 views

More Questions for you: