]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Fix memory leak in FGMRES.
authorheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 12 Oct 2010 18:50:40 +0000 (18:50 +0000)
committerheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 12 Oct 2010 18:50:40 +0000 (18:50 +0000)
git-svn-id: https://svn.dealii.org/trunk@22311 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/solver_gmres.h

index 73b3d0ab0a6f6b7ab0cbe8dd13758b6eb4d57082..a1c76a1b7b73e6cb3a69cdf205494296f94e9ac1 100644 (file)
@@ -891,9 +891,9 @@ SolverFGMRES<VECTOR>::solve (
 
   // Iteration starts here
 
+  VECTOR* aux = this->memory.alloc();
   do
     {
-      VECTOR* aux = this->memory.alloc();
       aux->reinit(x);
       A.vmult(*aux, x);
       aux->sadd(-1., 1., b);
@@ -941,9 +941,10 @@ SolverFGMRES<VECTOR>::solve (
       for (unsigned int j=0;j<y.size();++j)
        x.add(y(j), z[j]);
 
-      this->memory.free(aux);
     } while (iteration_state == SolverControl::iterate);
 
+  this->memory.free(aux);
+
   deallog.pop();
                                   // in case of failure: throw
                                   // exception

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.