[numerics] release memory without  NT scaling
@@ -1193,12 +1193,18 @@ void gfc3d_IPM(GlobalFrictionContactProblem* restrict problem, double* restrict
J->matrix2->origin = NSM_TRIPLET;
NM_insert(J, M, 0, 0);
- NM_insert(J, NM_transpose(minus_H), 0, m + nd);
+ NumericsMatrix * minus_Ht = NM_transpose(minus_H); // should be done only once
+ NM_insert(J, minus_Ht, 0, m + nd);
+ NM_free(minus_Ht);
if(options->iparam[SICONOS_FRICTION_3D_IPM_IPARAM_NESTEROV_TODD_SCALING] == 0)
{
- NM_insert(J, Arrow_repr(reaction, nd, n), m, m);
- NM_insert(J, Arrow_repr(velocity, nd, n), m, m + nd);
+ NumericsMatrix * arrow_r = Arrow_repr(reaction, nd, n);
+ NM_insert(J, arrow_r, m, m);
+ NM_free(arrow_r);
+ NumericsMatrix * arrow_v = Arrow_repr(velocity, nd, n) ;
+ NM_insert(J, arrow_v, m, m + nd);
+ NM_free(arrow_v);
}
else
{
