Re: Stack vs. Heap

Discussion in 'C++' started by David Sachs, Oct 10, 2003.

  1. David Sachs

    David Sachs Guest

    "Kevin Grigorenko" <> wrote in message
    news:bm2k9g$mki$...
    > Hello,
    >
    > I couldn't find an obvious answer to this in the FAQ. My basic question,
    > is: Is there any difference in allocating on the heap versus the stack?

    If
    > heap or stack implementation is not part of the standard, then just
    > disregard this question. Here's some questions I'm confused about, and if
    > you can add anything else, please do so!


    The c++ standard does not define "stack" in the context of the memory used
    to hold automatic variables, other than stating that it holds them.

    The current computer architectures, that I am familiar with, use a contguous
    memory area, with a register assigned to indicate where storage can be
    assigned from that area. The portion of this area used within a function is
    typically called a "stack frame" and holds automatic variables plus function
    return information.

    This is not the only way to manage automatic type storage. The standard
    convention for IBM 360... mainframes was for storage to be obtained and
    released as needed via operating system calls.

    The computer releated meaning of stack was derived by analogy from the stack
    of clean empty trays (often in a spring loaded container so that only the
    top tray could be taken) commonly used in cafeterias.
     
    David Sachs, Oct 10, 2003
    #1
    1. Advertising

  2. David Sachs wrote:
    [...]
    > This is not the only way to manage automatic type storage. The standard
    > convention for IBM 360... mainframes was for storage to be obtained and
    > released as needed via operating system calls.


    Modern mainframes can operate in kinda "hybrid mode". Storage for stack
    increments (it used for stack frames) is obtained ('getmained') and
    released "as needed" but you have usual "frames stuff" and guard pages
    within stack increment. And you can specify "KEEP|FREE" disposition.

    http://publibz.boulder.ibm.com/epubs/pdf/ceea2130.pdf
    http://publibz.boulder.ibm.com/epubs/pdf/ceea3130.pdf

    regards,
    alexander.
     
    Alexander Terekhov, Oct 10, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. joe

    stack and heap question

    joe, Aug 4, 2004, in forum: Java
    Replies:
    3
    Views:
    430
    Michael Borgwardt
    Aug 5, 2004
  2. Steve Hill

    vector.swap and heap / stack

    Steve Hill, Aug 20, 2003, in forum: C++
    Replies:
    5
    Views:
    1,006
    tom_usenet
    Aug 22, 2003
  3. Michal Slocinski

    Heap dump file size vs heap size

    Michal Slocinski, Mar 25, 2008, in forum: Java
    Replies:
    1
    Views:
    739
    GArlington
    Mar 25, 2008
  4. viki
    Replies:
    6
    Views:
    567
    Erik Wikström
    Jun 28, 2008
  5. Raymond Schanks
    Replies:
    0
    Views:
    539
    Raymond Schanks
    Apr 11, 2010
Loading...

Share This Page