Re: ALLOCATABLE arrays

From: Jugoslav Dujic (jdujicREMOVE_at_uns.ns.ac.yu)
Date: 01/05/04

  • Next message: Tony Jay: "Re: ALLOCATABLE arrays"
    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
    

  • Next message: Tony Jay: "Re: ALLOCATABLE arrays"

    Relevant Pages

    • Re: VB .Net and Intel Visual Fortran 9
      ... having is that the VB program cannot load the DLL. ... subroutine) to accept an array from VB - in my case a 2D array. ... Declare Sub mmult Lib "test.dll" (ByRef i As Double, ByRef j As Double, ...
      (comp.lang.fortran)
    • VB .Net and Intel Visual Fortran 9
      ... having is that the VB program cannot load the DLL. ... subroutine) to accept an array from VB - in my case a 2D array. ... Declare Sub mmult Lib "test.dll" (ByRef i As Double, ByRef j As Double, ...
      (comp.lang.basic.visual.misc)
    • Re: VB .Net and Intel Visual Fortran 9
      ... having is that the VB program cannot load the DLL. ... subroutine) to accept an array from VB - in my case a 2D array. ... Declare Sub mmult Lib "test.dll" (ByRef i As Double, ByRef j As Double, ...
      (comp.lang.basic.visual.misc)
    • Re: memory leak help!
      ... a loop from the main program. ... REPLACE THE NEW COMPLEX INTO ORIGINAL ARRAY x ... END OF SUBROUTINE SCEUA ... IMPLICIT NONE ...
      (comp.lang.fortran)
    • VB .Net and Intel Visual Fortran 9
      ... having is that the VB program cannot load the DLL. ... subroutine) to accept an array from VB - in my case a 2D array. ... Declare Sub mmult Lib "test.dll" (ByRef i As Double, ByRef j As Double, ...
      (comp.lang.fortran)