Re: Stacks and heaps
From: Thomas Matthews (Thomas_MatthewsSpitsOnSpamBots_at_sbcglobal.net)
Date: 06/03/04
- Next message: Dan Pop: "Re: What does the standard say about array access wraparound?"
- Previous message: Paul D. Boyle: "Re: fgets() replacement"
- In reply to: Sathyaish: "Stacks and heaps"
- Next in thread: Sathyaish: "Re: Stacks and heaps"
- Reply: Sathyaish: "Re: Stacks and heaps"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 03 Jun 2004 13:23:11 GMT
Sathyaish wrote:
> I've searched Google and found a few, but I am not so satisfied. Any
> good reading on "stacks and heaps" about how and when memory is
> allocated from the heap?
Often times, compilers use a heap for managing dynamic memory.
Dynamic memory is memory that is set aside for the program to
use during run-time.
Most of the time, programs use the *alloc() family of functions
to allocate from dynamic memory. The memory stays allocated until
either the program deallocates the memory via free or the
program is terminated (and the memory is re-used by the operating
system).
Dynamic memory often is used when the amount cannot be determined
during compile time, or when the program needs more memory than
the compiler can allocate during compile time (or program load
time).
Linked lists are a classic example of using dynamic memory
allocation.
--
Thomas Matthews
C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book
- Next message: Dan Pop: "Re: What does the standard say about array access wraparound?"
- Previous message: Paul D. Boyle: "Re: fgets() replacement"
- In reply to: Sathyaish: "Stacks and heaps"
- Next in thread: Sathyaish: "Re: Stacks and heaps"
- Reply: Sathyaish: "Re: Stacks and heaps"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|