add aubio_cleanup to clean fftw cached memory
authorPaul Brossier <piem@altern.org>
Thu, 13 Jul 2006 15:01:11 +0000 (15:01 +0000)
committerPaul Brossier <piem@altern.org>
Thu, 13 Jul 2006 15:01:11 +0000 (15:01 +0000)
add aubio_cleanup to clean fftw cached memory

src/mathutils.c
src/mathutils.h

index 79b4def..dfb4019 100644 (file)
@@ -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
+}
index a66780d..ef2def4 100644 (file)
@@ -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
 }