Stack/Heap?

  • Thread starter Thread starter tonyhall
  • Start date Start date
T

tonyhall

I am trying to find out how items on the stack are
stored, is it a FILO or a FIFO? Also what about the heap?

I ask as I have found two articles one stating that the
stack is stored as FILO and another saying FIFO!! and I
cant seem to find a definitive statement in MSDN

Can someone please clear this up for me

Thanks!
 
Well, consider a stack of dishes, you put new ones on top, and remove the
topmost ones when you need them.
This is how the cpu uses the its stack, First In, Last Out. I'm not sure
how the framework stack works, or if it is a conventional stack at all.
The heap is just that, a bunch of memory, items are stored at the first
available spot, but the position may change based on deletion of earlier
objects. The framework tries to keep all the used memory in one place so
new memory allocation can be speeded up.
This article may clarify some of it:

http://www.msdnaa.net/Resources/Display.aspx?ResID=601
 
Back
Top