Stack/Heap?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • tonyhall

    Stack/Heap?

    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!
  • Morten Wennevik

    #2
    Re: Stack/Heap?

    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:

    They don't rush—they ripple. Meet the koi, photogr


    --
    Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/

    Comment

    • Jan Tielens

      #3
      Re: Stack/Heap?

      The Stack class is implemented as a LIFO (Last In First Out). The Queue
      class is implemented as FIFO (First In First Out).

      See the following article about more information:

      s1.mspx#Stack%2 0Class

      --
      Greetz

      Jan Tielens
      _______________ _______________ __
      Read my weblog: http://weblogs.asp.net/jan


      "tonyhall" <anonymous@disc ussions.microso ft.com> wrote in message
      news:01e601c3bd 69$687acd40$a00 1280a@phx.gbl.. .[color=blue]
      > 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![/color]


      Comment

      Working...