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.

http://gribblelab.org/cbootcamp/7_memory_stack_vs_heap.html


Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -