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
2206
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: alake, Baidu [Spider], Bing [Bot], bjoernbalazs, braystacey, Dimitrios, edmael, einar, Exabot [Bot], flotho, Google [Bot], google01103, ivan, Joif, ken300, maarten, Majestic-12 [Bot], nezumi, peje, rdong, SecretCode, skywolfblue, stephans, Steve T, TheraHedwig, tienhung, Yahoo [Bot]