Reply to topic

Memory Allocation

johnsiner
Registered Member
Posts
1
Karma
0

Memory Allocation

Mon Nov 12, 2012 12:47 pm
I was wondering how to deallocate the memory used in Eigen. For example if I create the following matrix:

MatrixXd test = MatrixXd(1000,1000);

How would I free the memory allocated to test? Thanks!
User avatar ggael
Moderator
Posts
2198
Karma
15
OS

Re: Memory Allocation

Tue Nov 13, 2012 8:13 pm
The memory will be automatically freed when "test" will be deleted, e.g.:
Code: Select all
void foo() {
  ....
  {
      MatrixXd test = MatrixXd(1000,1000);
      ....
   }
   // at this stage test has been automatically deleted and freed
   ....
}


You can also call test.resize(0,0);

 
Reply to topic

Bookmarks



Who is online

Registered users: afiestas, avishekk, Baidu [Spider], bcooksley, Bing [Bot], bjoernbalazs, brankko, colomar, Cris70, david_edmundson, einar, Exabot [Bot], ggael, Google [Bot], Heiko Tietze, joshaughnessy, ken300, koriun, La Ninje, lueck, Majestic-12 [Bot], metalbrick, mmagnusson, ooker, rossdv8, seal20, starbuck, stavallo, steltsop, steph, SysGhost, valoriez, vHanda, Yahoo [Bot]