Memory leaks in standard code

Tobias Schlüter Tobias.Schlueter@physik.uni-muenchen.de
Fri Feb 15 13:24:00 GMT 2008


FX wrote:
>  I realize, though, that
> having memory leaks is rather hard in Fortran, because of the
> automatic deallocation on procedure exit... so I'm asking a very naive
> question: is it possible at all?

REAL, ALLOCATABLE :: A(:)
DO WHILE(!condition)
   ! Do something
   ALLOCATE(A(50))
END DO
END

generates a memory leak, unless ALLOCATE guards against this.

Cheers,
- Tobi

-- 
Tobias Schlüter
Am Coulombwall 1, Zi. 326
85748 Garching b. München
Tel.: +49/89/289-14139



More information about the Fortran mailing list