mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-10-31 15:47:10 -04:00
Clean up some memory leaks
Move the FFTW3 cleanup into the main routine as it should only be called once rather than every time the settings configuration is changed or reset (MultiSettings). Call the new fini_ldpc_ routine before exiting in the main routine to free the LDPC resources. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6764 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
c5c3d14689
commit
30959cf1c9
21
main.cpp
21
main.cpp
@ -4,6 +4,7 @@
|
||||
#include <string>
|
||||
|
||||
#include <locale.h>
|
||||
#include <fftw3.h>
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QApplication>
|
||||
@ -36,6 +37,12 @@
|
||||
#include "Radio.hpp"
|
||||
#include "FrequencyList.hpp"
|
||||
|
||||
extern "C" {
|
||||
// Fortran procedures we need
|
||||
void four2a_(_Complex float *, int * nfft, int * ndim, int * isign, int * iform, int len);
|
||||
void fini_ldpc_ ();
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
struct RNGSetup
|
||||
@ -293,6 +300,20 @@ int main(int argc, char *argv[])
|
||||
result = a.exec();
|
||||
}
|
||||
while (!result && !multi_settings.exit ());
|
||||
|
||||
// clean up lazily initialized resources
|
||||
{
|
||||
int nfft {-1};
|
||||
int ndim {1};
|
||||
int isign {1};
|
||||
int iform {1};
|
||||
// free FFT plan resources
|
||||
four2a_ (nullptr, &nfft, &ndim, &isign, &iform, 0);
|
||||
}
|
||||
fftwf_forget_wisdom ();
|
||||
fftwf_cleanup ();
|
||||
fini_ldpc_ (); // free LDPC decoder resources
|
||||
|
||||
temp_dir.removeRecursively (); // clean up temp files
|
||||
return result;
|
||||
}
|
||||
|
@ -63,8 +63,6 @@ extern "C" {
|
||||
void symspec_(struct dec_data *, int* k, int* ntrperiod, int* nsps, int* ingain, int* minw,
|
||||
float* px, float s[], float* df3, int* nhsym, int* npts8);
|
||||
|
||||
void four2a_(_Complex float *, int * nfft, int * ndim, int * isign, int * iform, int len);
|
||||
|
||||
void hspec_(short int d2[], int* k, int* ingain, float green[], float s[], int* jh);
|
||||
|
||||
void gen4_(char* msg, int* ichk, char* msgsent, int itone[],
|
||||
@ -832,16 +830,6 @@ MainWindow::~MainWindow()
|
||||
QString fname {QDir::toNativeSeparators(m_dataDir.absoluteFilePath ("wsjtx_wisdom.dat"))};
|
||||
QByteArray cfname=fname.toLocal8Bit();
|
||||
fftwf_export_wisdom_to_filename(cfname);
|
||||
{
|
||||
int nfft {-1};
|
||||
int ndim {1};
|
||||
int isign {1};
|
||||
int iform {1};
|
||||
// free FFT plan resources
|
||||
four2a_ (nullptr, &nfft, &ndim, &isign, &iform, 0);
|
||||
}
|
||||
fftwf_forget_wisdom ();
|
||||
fftwf_cleanup ();
|
||||
m_audioThread.quit ();
|
||||
m_audioThread.wait ();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user