Re: heap allocation of arrays
- From: "Jugoslav Dujic" <jdujic@xxxxxxxxx>
- Date: Mon, 19 Jun 2006 14:41:03 +0200
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?
FWIW, I deem Glen's proposal that the maximal *size* of stack
array is selectable the most reasonable compromise between
usability (c'mon, does one really want to heap-allocate bunch
of small variables just because one of them causes stack overflow)
and ease of implementation.
I recall a discussion on Intel Forum regarding a suggestion of
an "opposite" feature -- make ALLOCATABLE arrays to be allocated
on the stack if they fit, for efficiency reasons. As Steve explained
then, it's not easy to get the top of the stack on Windows, so it
wasn't quite feasible thing to do.
--
Jugoslav
___________
www.xeffort.com
Please reply to the newsgroup.
You can find my real e-mail on my home page above.
.
- Follow-Ups:
- Re: heap allocation of arrays
- From: glen herrmannsfeldt
- Re: heap allocation of arrays
- References:
- heap allocation of arrays
- From: robert . corbett
- heap allocation of arrays
- Prev by Date: Re: using the same function for stdout and files
- Next by Date: Re: Array of subroutines
- Previous by thread: Re: heap allocation of arrays
- Next by thread: Re: heap allocation of arrays
- Index(es):
Relevant Pages
|