From: Paul Brossier Date: Thu, 13 Jul 2006 15:01:11 +0000 (+0000) Subject: add aubio_cleanup to clean fftw cached memory X-Git-Tag: bzr2git~619 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=714380d80ba23ef6a90d2c478b89ac519acfe1c1;p=aubio.git add aubio_cleanup to clean fftw cached memory add aubio_cleanup to clean fftw cached memory --- diff --git a/src/mathutils.c b/src/mathutils.c index 79b4def5..dfb40195 100644 --- a/src/mathutils.c +++ b/src/mathutils.c @@ -22,6 +22,7 @@ #include "aubio_priv.h" #include "sample.h" #include "mathutils.h" +#include "config.h" void aubio_window(smpl_t *w, uint_t size, aubio_window_type wintype) { uint_t i; @@ -453,3 +454,13 @@ void aubio_autocorr(fvec_t * input, fvec_t * output){ } } +void aubio_cleanup(void) +{ +#if FFTW3_SUPPORT + fftw_cleanup(); +#else +#if FFTW3F_SUPPORT + fftwf_cleanup(); +#endif +#endif +} diff --git a/src/mathutils.h b/src/mathutils.h index a66780dd..ef2def44 100644 --- a/src/mathutils.h +++ b/src/mathutils.h @@ -245,6 +245,14 @@ smpl_t aubio_level_detection(fvec_t * ibuf, smpl_t threshold); * calculate normalised autocorrelation function */ void aubio_autocorr(fvec_t * input, fvec_t * output); +/** + * clean up cached memory at the end of program + * + * use this function at the end of programs to purge all + * cached memory. so far this function is only used to clean + * fftw cache. + */ +void aubio_cleanup(void); #ifdef __cplusplus }