javier_garcia-p
04-30-2010, 01:30 AM
Hi all;
I have a SUBROUTINE with a local allocatable array:
REAL(DP), ALLOCATABLE, DIMENSION(:), SAVE :: tmp
It seems to me this array cannot de DEALLOCATED within the subroutine
This SUBROUTINE is designed to work within a program that usually does one run for a number of timesteps , and the array is allocated at the first time step (it is a formal argument to the subroutine).
IF (it == 1) THEN
ALLOCATE(tmp(nsteps), STAT=status)
END IF
However, if I am going to conduct a MonteCarlo analysis, where the calling program does not terminate and this subrutine is going to be called thousands of times with the condition it == 1 being TRUE. The following crashes at compilation:
IF ( it == nsteps) THEN
DEALLOCATE(tmp, STAT=status)
error = error + status
END IF
So it seems deallocation of "SAVE" arrays cannot be done. Is this right?
Thanks and best regards,
Javier
---
I have a SUBROUTINE with a local allocatable array:
REAL(DP), ALLOCATABLE, DIMENSION(:), SAVE :: tmp
It seems to me this array cannot de DEALLOCATED within the subroutine
This SUBROUTINE is designed to work within a program that usually does one run for a number of timesteps , and the array is allocated at the first time step (it is a formal argument to the subroutine).
IF (it == 1) THEN
ALLOCATE(tmp(nsteps), STAT=status)
END IF
However, if I am going to conduct a MonteCarlo analysis, where the calling program does not terminate and this subrutine is going to be called thousands of times with the condition it == 1 being TRUE. The following crashes at compilation:
IF ( it == nsteps) THEN
DEALLOCATE(tmp, STAT=status)
error = error + status
END IF
So it seems deallocation of "SAVE" arrays cannot be done. Is this right?
Thanks and best regards,
Javier
---