Skip to content
Snippets Groups Projects
Commit a150de43 authored by Andreas Schenk's avatar Andreas Schenk
Browse files

added fftw_cleanup to FFT dtor to release memory used by fftw

parent 253ebcf6
No related branches found
No related tags found
No related merge requests found
...@@ -64,6 +64,10 @@ FFTFnc::FFTFnc(bool f): ori_flag_(f) ...@@ -64,6 +64,10 @@ FFTFnc::FFTFnc(bool f): ori_flag_(f)
OST_FFTW_fftw_init_threads(); OST_FFTW_fftw_init_threads();
} }
FFTFnc::~FFTFnc()
{
OST_FFTW_fftw_cleanup();
}
// real spatial -> complex half-frequency // real spatial -> complex half-frequency
template <> template <>
......
...@@ -37,7 +37,7 @@ struct DLLEXPORT FFTException: public Error { ...@@ -37,7 +37,7 @@ struct DLLEXPORT FFTException: public Error {
struct DLLEXPORT_IMG_ALG FFTFnc { struct DLLEXPORT_IMG_ALG FFTFnc {
FFTFnc(); FFTFnc();
FFTFnc(bool); FFTFnc(bool);
~FFTFnc();
template <typename T, class D> template <typename T, class D>
ImageStateBasePtr VisitState(const ImageStateImpl<T,D>& s) const; ImageStateBasePtr VisitState(const ImageStateImpl<T,D>& s) const;
......
...@@ -72,15 +72,22 @@ Author: Juergen Haas ...@@ -72,15 +72,22 @@ Author: Juergen Haas
#if OST_FFT_USE_THREADS #if OST_FFT_USE_THREADS
#if OST_DOUBLE_PRECISION #if OST_DOUBLE_PRECISION
#define OST_FFTW_fftw_init_threads fftw_init_threads #define OST_FFTW_fftw_init_threads fftw_init_threads
#define OST_FFTW_fftw_cleanup fftw_cleanup_threads
#define OST_FFTW_fftw_plan_with_nthreads fftw_plan_with_nthreads #define OST_FFTW_fftw_plan_with_nthreads fftw_plan_with_nthreads
#else #else
#define OST_FFTW_fftw_init_threads fftwf_init_threads #define OST_FFTW_fftw_init_threads fftwf_init_threads
#define OST_FFTW_fftw_cleanup fftwf_cleanup_threads
#define OST_FFTW_fftw_plan_with_nthreads fftwf_plan_with_nthreads #define OST_FFTW_fftw_plan_with_nthreads fftwf_plan_with_nthreads
#endif #endif
#else #else
void fftw_noop(unsigned int i=0){} void fftw_noop(unsigned int i=0){}
#define OST_FFTW_fftw_init_threads fftw_noop #define OST_FFTW_fftw_init_threads fftw_noop
#define OST_FFTW_fftw_plan_with_nthreads fftw_noop #define OST_FFTW_fftw_plan_with_nthreads fftw_noop
#if OST_DOUBLE_PRECISION
#define OST_FFTW_fftw_cleanup fftw_cleanup
#else
#define OST_FFTW_fftw_cleanup fftwf_cleanup
#endif
#endif #endif
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment