Re: Off Topic: Stack vs. Heap

From: Kevin Grigorenko (kzg110_at_psu.edu)
Date: 10/09/03


Date: Thu, 9 Oct 2003 01:08:20 -0400


"E. Robert Tisdale" <E.Robert.Tisdale@jpl.nasa.gov> wrote in message
news:3F84DA97.5050403@jpl.nasa.gov...
> Kevin Grigorenko wrote:
>
> >
> >
> > 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!
> >
> > Is the stack limited for each program?
> >
> > On the other hand, is the heap basically limitless (except of course
limited
> > to the size of memory or page files)?
> >
> > If I've got something on the heap, as I understand it, another program
can
> > update any of my allocated storage without me knowing? Can this happen
on
> > the stack?
> >
> > Is there any performance difference in using variables on the stack
versus
> > on the heap?
> >
> > Are global and static variables on the stack?
> >
> > The reason I ask is I'm starting to get into C#, and it makes a big deal
> > about allocating a lot of stuff on a garbage collected heap. I wouldn't
> > want to start asking off-topic questions, so I'll just ask this: would a
> > concept like this follow from the fact that heap storage is better to
use
> > for some reason rather than storage on the stack?
>
> It depends upon your compiler.
> Please tell us which compiler you are using
> so that we can redirect to to the appropriate newsgroup.
>
>

All of those questions are non-standard? Ok, I have no doubts, you guys are
the experts. Let's say the compiler I'm using is VC++6. Also, I was
looking for a C# newsgroup, so if you could also direct me to where I can
post questions regarding that, that would be great. I couldn't find
anything to the effect of comp.lang.csharp.

Is the concept of stack and heap completely independent of the standard?

Thanks again!
Kevin Grigorenko



Relevant Pages

  • Re: GNAT GPL for Mac OSX stack checking problem
    ... The compiler and GPS seem to work, it is the generated test driver ... documentation to increase it under macos, but traditionally, the stack ... Linux GNAT uses the heap, Rational Apex uses the heap, the VADs Ada83 ... The above test driver would not have run on older Linux releases using ...
    (comp.lang.ada)
  • Re: Value Types and Reference Types
    ... There is a stack and a heap. ... The compiler basically has a list of types that are ... If you do int x and then object y = x. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: GNAT GPL for Mac OSX stack checking problem
    ... >> The compiler and GPS seem to work, it is the generated test driver ... >> documentation to increase it under macos, but traditionally, the stack ... >> Linux GNAT uses the heap, Rational Apex uses the heap, the VADs Ada83 ...
    (comp.lang.ada)
  • Re: How does managed code work?
    ... Does it work the same way as the native stack with a frame pointer that is the head of a linked list of stack frames where each time we enter a function we create a new stack frame in which new variables are pushed and each time we exit a function the entire stack frame is popped? ... Can someone point me to a discussion of the managed heap? ... How does it prevent memory leaks that occur in COM when two objects reference each other and keep the others reference count nonzero? ... Because objects don't go out of scope, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Groovy (war Re: [PROST]Re: CDC Plugin fuer Eclipse)
    ... Warum müsste man continuations erlauben Stackvariablen in den Heap zu verschieben? ... Ein activation record speichert die Parameter und lokalen Variablen der Funktion und eine Information, ... Da diese activation records klassischerweise auf einem Stack verwaltet werden, kann man hier Stackspace sparen - Endrekursion ist damit genauso effizient wie eine klassische Iteration mit einem Sprung. ...
    (de.comp.lang.java)