heap allocation of arrays



I recently received a request to add an option to Sun Fortran
to force all arrays to be allocated on the heap. Automatic
arrays and other arrays that would normally be allocated on
the stack would be replaced with pointers on the stack.
Space for the arrays would be allocated and deallocated
using malloc and free.

The motivations given for requesting this option were that
the default stack size for most programs is smaller than the
default heap size and that failure to allocate space on the
heap is easier to detect than failure to allocate space on the
stack.

What do you think about such an option?

Bob Corbett

.



Relevant Pages

  • Re: run-time vs compile-time
    ... > offset related to some location (like stack base) somewhere. ... > offset from heap to pi. ... When you allocate an int on the heap, it is allocated at address 1. ... application has a given amount of memory it can use as it wishes. ...
    (alt.comp.lang.learn.c-cpp)
  • Re: run-time vs compile-time
    ... > offset related to some location (like stack base) somewhere. ... > offset from heap to pi. ... When you allocate an int on the heap, it is allocated at address 1. ... application has a given amount of memory it can use as it wishes. ...
    (comp.lang.cpp)
  • Re: "Heap" (was Re: static, global variable memory allocation)
    ... common to refer to the area used to allocate automatic objects ... Can a perverse but conforming implementation use the "heap" for ... used a linked list of save areas instead of a stack. ... CPU-specific region of memory that grows linearly in one direction, ...
    (comp.lang.c)
  • Re: heap allocation of arrays
    ... to force all arrays to be allocated on the heap. ... the stack would be replaced with pointers on the stack. ... heap is easier to detect than failure to allocate space on the ...
    (comp.lang.fortran)
  • Re: heap allocation of arrays
    ... | to force all arrays to be allocated on the heap. ... | the stack would be replaced with pointers on the stack. ... | heap is easier to detect than failure to allocate space on the ...
    (comp.lang.fortran)