Re: heap allocation of arrays
- From: Jan Vorbrüggen <jvorbrueggen@xxxxxxxxxxxxxxx>
- Date: Mon, 19 Jun 2006 14:26:12 +0200
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.
_If_ indeed one needs to increase the stack size explicitly (such
as with Winwoes), this is a convenience option, agreed. I do believe,
however, that the OS should be able to adapt the stack size appropriately.
Threaded code, with smallish stacks for each thread that cannot easily
be auto-expanded, would be another reason to at least have this option.
The detection does seem easier, because there is an explicit malloc() that
can fail, and it's fairly easy to attribute that failure to a particular
allocation request. If stack allocation is just a computation on the stack
pointer on routine entry and failure then is an access violation, there is
no way to attribute the failure to a particular array, and indeed its often
difficult to distinguish this failure from any other access violation.
Summary: I think it would be a good feature to have, but certainly not the
default. Do you already offer pragmas? If so, allow the programmer to set
this option on a per-array basis.
Jan
.
- References:
- heap allocation of arrays
- From: robert . corbett
- heap allocation of arrays
- Prev by Date: Re: Performance of allocatable components implementation
- Next by Date: Re: using the same function for stdout and files
- Previous by thread: Re: heap allocation of arrays
- Next by thread: Re: heap allocation of arrays
- Index(es):
Relevant Pages
|