Two stack dynamic memory allocation

  • Authors:
  • Gordon Bassen;Issak Garber

  • Affiliations:
  • Dept of Mathematics and Computer Science, Kingsborough Community College, 2001 Oriental Blvd. Brooklyn, NY;Dept of Mathematics and Computer Science, Kingsborough Community College, 2001 Oriental Blvd. Brooklyn, NY

  • Venue:
  • Journal of Computing Sciences in Colleges
  • Year:
  • 2002

Quantified Score

Hi-index 0.00

Visualization

Abstract

A new technique in the creation of the stack frame of a function has been developed with the capability of storing dynamic variables in the same area as local variables. This innovation permits the writing of an array declaration in C/C++ type languages, such as: int arr[n]; to be used within a function in the cases where: 1) n is a constant or, 2) n is a variable with a run time calculated value. Stack allocation as it is currently implemented, allows for run-time variable storing only when a function is called (activated). It does not permit changing the size of the area while the function is executing. This paper illustrates how this disadvantage can be overcome. As a result existence of the heap may no longer be necessary. Furthermore, the authors have developed the capability within object-oriented languages of passing dynamically allocated variables or arrays to the calling function. A high-level language which uses this method of compiling will be simpler, and have the ability to create more compact, efficient, and effective code without losing the strengths and capabilities of existent languages.