K
Kevin Grigorenko
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!
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?
I appreciate it!
Kevin Grigorenko
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?
I appreciate it!
Kevin Grigorenko