Re: Heap vs Stack
- From: "David T. Ashley" <dta@xxxxxxxx>
- Date: Sun, 8 Jul 2007 10:17:52 -0400
"Nehil" <nehilparashar@xxxxxxxxx> wrote in message
news:1183894832.890803.254790@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I would like to know which is dynamic in nature.
if i refer the C memory model (Richard Steven), it is shown that both
stack and heap grow towards each other.
Now, can one go into other's area and hence effecting the size of
other memory area.
Does any limit exist upto which a stack or a heap can grow. and if it
is there then who decides the limit?
Stack and heap are in some sense related concepts, except for the required
order of release. It is not uncommon with certain development tools to have
functions that will claim space on the stack and return a pointer (similar
to malloc). However, such claimed areas have to be released from the bottom
up (they can't be preserved when a function returns).
In a modern operating system (on modern hardware), the limit is typically a
feature of the operating system on the platform. 4GB is typical. It
doesn't normally make sense to have this limit configurable -- with modern
hardware (pages, page faults, and all that) the system can normally move
stuff around as the program's memory needs grow until the limit is reached.
--
David T. Ashley (dta@xxxxxxxx)
http://www.e3ft.com (Consulting Home Page)
http://www.dtashley.com (Personal Home Page)
http://gpl.e3ft.com (GPL Publications and Projects)
.
- References:
- Heap vs Stack
- From: Nehil
- Heap vs Stack
- Prev by Date: Process and its memory Limit. (Linux biased)
- Next by Date: exec function
- Previous by thread: Heap vs Stack
- Next by thread: Re: Heap vs Stack
- Index(es):
Relevant Pages
|