Re: heap allocation of arrays
- From: Norman Yarvin <norman.yarvin@xxxxxxxx>
- Date: Wed, 21 Jun 2006 14:40:14 -0500
In article <1150702551.395722.174570@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
<robert.corbett@xxxxxxx> wrote:
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?
It doesn't make much sense. If someone has to explicitly activate that
option, they might as well be explicitly increasing the stack size; the
one is as easy to do as the other.
Allocating arrays on the stack is nice, because it doesn't contribute to
fragmentation of the heap.
I'd address these concerns by simply adding code to the default Fortran
runtime initialization routine that made the stack size unlimited, for
all Fortran users. Then the problem goes away even for people who didn't
know about it.
--
Norman Yarvin http://yarchive.net
.
- Follow-Ups:
- Re: heap allocation of arrays
- From: Jan Vorbrüggen
- Re: heap allocation of arrays
- From: robert . corbett
- Re: heap allocation of arrays
- References:
- heap allocation of arrays
- From: robert . corbett
- heap allocation of arrays
- Prev by Date: Re: Save an array to memory for another program to read it
- Next by Date: Re: help for reading a binary file
- Previous by thread: Re: heap allocation of arrays
- Next by thread: Re: heap allocation of arrays
- Index(es):
Relevant Pages
|