Free memory in c++ (armadillo) -
i want free memory after using object ('ii', in following program) in c++:
#include <iostream> #include <armadillo> using namespace std; using namespace arma; int main() { cx_mat ii(2,2,fill::eye); cout << ii <<endl; free (ii); return 0; } but after compiling, encounter following error:
error: cannot convert ‘arma::cx_mat {aka arma::mat<std::complex<double> >}’ ‘void*’ argument ‘1’ ‘void free(void*)’ can body guide me?
cx_mat ii(2,2,fill::eye); that's allocated on stack, can't free it, destroyed when program exits scope.
Comments
Post a Comment