Call fftwf_cleanup() from four2a to free all remaining fftw memory.

This commit is contained in:
Joe Taylor 2019-02-15 09:38:28 -05:00
parent 3c77b720f8
commit 41c22b0153

View File

@ -19,6 +19,7 @@ subroutine four2a(a,nfft,ndim,isign,iform)
! This version of four2a makes calls to the FFTW library to do the ! This version of four2a makes calls to the FFTW library to do the
! actual computations. ! actual computations.
use fftw3
parameter (NPMAX=2100) !Max numberf of stored plans parameter (NPMAX=2100) !Max numberf of stored plans
parameter (NSMALL=16384) !Max size of "small" FFTs parameter (NSMALL=16384) !Max size of "small" FFTs
complex a(nfft) !Array to be transformed complex a(nfft) !Array to be transformed
@ -29,7 +30,6 @@ subroutine four2a(a,nfft,ndim,isign,iform)
logical found_plan logical found_plan
data nplan/0/ !Number of stored plans data nplan/0/ !Number of stored plans
common/patience/npatience,nthreads !Patience and threads for FFTW plans common/patience/npatience,nthreads !Patience and threads for FFTW plans
include 'fftw3.f90' !FFTW definitions
save plan,nplan,nn,ns,nf,nl save plan,nplan,nn,ns,nf,nl
if(nfft.lt.0) go to 999 if(nfft.lt.0) go to 999
@ -107,7 +107,7 @@ subroutine four2a(a,nfft,ndim,isign,iform)
!$omp end critical(fftw) !$omp end critical(fftw)
end if end if
enddo enddo
call fftwf_cleanup()
nplan=0 nplan=0
!$omp end critical(four2a) !$omp end critical(four2a)