Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Turbo Pascal - <b> heap heap and stack utilization pp 225</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 HEAP                     Heap and Stack Utilization                  pp 225


 Define:  The Stack and Heap are memory areas outside the Code and Data
          segments.  They are maintained by the run-time code.

 Purpose: The Heap is used to store dynamic variables.
          The Stack is is used to store local variables, intermediate
          results during evaluation of expressions, and as a means to
          pass parameters to and from functions and procedures.

 Notes:   During execution of a Turbo program a Code segment, Data segment
          and Stack segment are allocated for the program.
          The Stack segment can be much larger than 64k, as it encompasses
          the remainder of free memory not used by the Code & Data segments.

          At program startup, the heap pointer HeapPtr is set to low
          memory in the Stack segment.  The heap grows Upward in memory.

          The stack pointer is set to the highest address in the stack
          segment at program startup.  The stack grows Downward in memory.

          The stack and heap can collide, resulting in system lockup if
          collision checking  {$K-}  is passive.

See Also: GetMem HeapPtr MaxAvail New Pointer

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson