Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Re: Stack vs. Heap

Reply
Thread Tools

Re: Stack vs. Heap

 
 
David Sachs
Guest
Posts: n/a
 
      10-10-2003
"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.


 
Reply With Quote
 
 
 
 
Alexander Terekhov
Guest
Posts: n/a
 
      10-10-2003

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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How much heap can I reserve for JVM? Error when allocation very much heap Raymond Schanks Java 0 04-11-2010 04:25 PM
C/C++ compilers have one stack for local variables and return addresses and then another stack for array allocations on the stack. Casey Hawthorne C Programming 3 11-01-2009 08:23 PM
stl heap question: restoring heap validinty after changing 1 element viki C++ 6 06-28-2008 10:12 AM
Heap dump file size vs heap size Michal Slocinski Java 1 03-25-2008 12:54 PM
stack and heap question joe Java 3 08-05-2004 08:24 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57