Skip to content
Snippets Groups Projects
Commit 3c8bfc5e authored by Sébastien Villemot's avatar Sébastien Villemot
Browse files

Estimation DLL, dynamic DLL loading: fixed memory leaks

parent eb4efa59
No related branches found
No related tags found
No related merge requests found
...@@ -118,11 +118,7 @@ DynamicModelDLL::eval(const Vector &y, const Matrix &x, const Vector *modParams ...@@ -118,11 +118,7 @@ DynamicModelDLL::eval(const Vector &y, const Matrix &x, const Vector *modParams
if (g1 != NULL) if (g1 != NULL)
{ {
if (g1->getRows() != length) // dummy if (g1->getRows() != length) // dummy
{ throw TSException(__FILE__, __LINE__, "DLL Error: g1 has wrong size");
delete g1;
g1 = new Matrix(length, jcols); // and get a new one
g1->setAll(0.0); //zero
}
dg1 = const_cast<double *>(g1->getData()); dg1 = const_cast<double *>(g1->getData());
} }
if (g2 != NULL) if (g2 != NULL)
...@@ -153,7 +149,7 @@ DynamicModelDLL::eval(const Vector &y, const Vector &x, const Vector *modParams, ...@@ -153,7 +149,7 @@ DynamicModelDLL::eval(const Vector &y, const Vector &x, const Vector *modParams,
* when calling <model>_dynamic(z,x,params,it_) x must be equal to * when calling <model>_dynamic(z,x,params,it_) x must be equal to
* zeros(M_.maximum_lag+1,M_.exo_nbr) * zeros(M_.maximum_lag+1,M_.exo_nbr)
**/ **/
Matrix &mx = *(new Matrix(nMax_lag+1, nExog)); Matrix mx(nMax_lag+1, nExog);
mx.setAll(0); // initialise shocks to 0s mx.setAll(0); // initialise shocks to 0s
eval(y, mx, modParams, nMax_lag, residual, g1, g2, g3); eval(y, mx, modParams, nMax_lag, residual, g1, g2, g3);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment