shithub: aubio

Download patch

ref: 714380d80ba23ef6a90d2c478b89ac519acfe1c1
parent: bf8e1344a4dc8e764f1a86e4a833fcce0142a65b
author: Paul Brossier <piem@altern.org>
date: Thu Jul 13 11:01:11 EDT 2006

add aubio_cleanup to clean fftw cached memory
add aubio_cleanup to clean fftw cached memory


--- 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_cleanup(void)
+{
+#if FFTW3_SUPPORT
+        fftw_cleanup();
+#else
+#if FFTW3F_SUPPORT
+        fftwf_cleanup();
+#endif
+#endif
+}
--- a/src/mathutils.h
+++ b/src/mathutils.h
@@ -245,6 +245,14 @@
  * 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
 }