Hello,
we need to allocate and deallocate a character field within a do-loop (please see example code below). Using the compiler flags /check or /undef we have discovered that the executable doesn't release the allocated memory but keeps allocating more and more system memory. With /debug or without any debugging flags everything works fine.
We use FTN95 version 5.3.0 and 4.9.1 on WinXP.
Is this behaviour correct? Does anybody know a workaround for this? Any help is very much appreciated.
Regards, Daniel.
Example code:
program allocate_test implicit none
integer, parameter :: bwidth=500 integer :: i,n character(len=bwidth),allocatable,dimension(:) :: buffer
n=10
do i=1,20
write(6,) 'i=',i
if (allocated(buffer)) then
deallocate(buffer)
end if
write(6,) 'allocating buffer...'
pause
allocate(buffer(n+2i))
buffer(:)=' '
write(6,) 'press any key to deallocate buffer...'
pause
deallocate(buffer)
end do
end program allocate_test