Re: ALLOCATABLE arrays
From: Jugoslav Dujic (jdujicREMOVE_at_uns.ns.ac.yu)
Date: 01/05/04
- Previous message: Scott Robert Ladd: "Merseene Twister -- A New Fortran 95 Implementation"
- In reply to: Gus Gassmann: "Re: ALLOCATABLE arrays"
- Next in thread: Tony Jay: "Re: ALLOCATABLE arrays"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 5 Jan 2004 15:23:46 +0100
Gus Gassmann wrote:
| Jugoslav Dujic wrote:
|
|| Gus Gassmann wrote:
|||
||| Here is my situation. I have a subroutine that is called from
||| many different places and requires a one-dimensional work
||| vector. Since I do not know beforehand how big it will have
||| to be, I want to make it allocatable.
||
|| I'd also suggest that you take a look at automatic arrays
|
| Do I read this right?
|
| Suppose I declare
|
| subroutine test
| integer :: i
| dimension i(k)
|
| where k is set in a module somewhere. Is it then the case that
| a) i gets allocated automatically on entry to test and deallocated
| on exit
| b) this operation takes (essentially) zero time?
|
| Is that really all there is to it? I'm afraid to look a gift horse
| in the mouth, but this sounds too good to be true!
The only potential caveat is limited stack size on certain machines, which
can arise if the work array is HUGE. Under Windows, default stack size
per process/thread is 1 MB (actually, that's the default value for most-used
Microsoft linker, not an OS limitation); under unixes, defaults vary
(but are typically more generous AFAIK). Usually, that can be changed as a
linker option or using a separate program (EDITBIN on Windows, an OS setting
on unixes). If your array is up to about a 100,000 elements, there's probably
no reason to worry about it.
-- Jugoslav ___________ www.geocities.com/jdujic
- Previous message: Scott Robert Ladd: "Merseene Twister -- A New Fortran 95 Implementation"
- In reply to: Gus Gassmann: "Re: ALLOCATABLE arrays"
- Next in thread: Tony Jay: "Re: ALLOCATABLE arrays"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|