'c++ Eigen::VectorXd initialized in a loop
I have a for loop in which i initialize randomly 3 eigen vectors like
for(int i=0; i<10000; i++){
Eigen::VectorXd state(mysize), dstate(mysize), tau(mysize);
state.setRandom();
tau.setRandom();
double time = 0.0;
dstate = dosomething(time, state, tau);
}
Everything work quite well but the memory grows indefinitely. I know that using Eigen::VectorXd the memory is reserved on the heap but when I initialize again should by released, right?. I also tried to resize the vectors to zero at the end of the loop but nothing change the occupied memory grows.
My question is, why this happen?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
