]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Apply a patch by Daniel Goldberg, sent 2008/2/20: Fix a memory leak that made PETSc...
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Sat, 23 Feb 2008 19:57:34 +0000 (19:57 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Sat, 23 Feb 2008 19:57:34 +0000 (19:57 +0000)
git-svn-id: https://svn.dealii.org/trunk@15762 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/doc/news/changes.h
deal.II/lac/source/petsc_matrix_base.cc

index c2ea7c8cfef213547c4234599b5aa2fd1e1b7956..422218b44cc30a34d3573b5be4034db3f164f587 100644 (file)
@@ -215,6 +215,13 @@ an integer id of the current thread.
 
 <ol>
 
+<li> Fixed: The PETScWrappers::MatrixBase::clear_row and
+PETScWrappers::MatrixBase::clear_rows functions had a memory leak that made
+PETSc become progressively slower over time. This is now fixed.
+<br>
+(Daniel Goldberg 2008/2/20)
+</li>
+
 <li> Improved: All GrowingVectorMemory objects that have the same template
 argument will access the same memory pool. Therefore, it is now not a
 crime any more to just create a memory pool and discard later. Furthermore,
index ff4b69f03be51ec977ec1e473ef4ec241357469a..48cca472d8d6591a76287179de78ce330979c487 100644 (file)
@@ -214,7 +214,6 @@ namespace PETScWrappers
 
                                      // now set all the entries of this row to
                                      // zero
-    IS index_set;
 #if (PETSC_VERSION_MAJOR <= 2) && \
     ((PETSC_VERSION_MINOR < 2) ||  \
      ((PETSC_VERSION_MINOR == 2) && (PETSC_VERSION_SUBMINOR == 0)))
@@ -222,6 +221,8 @@ namespace PETScWrappers
 #else
     const PetscInt petsc_row = row;
 #endif
+    
+    IS index_set;
     ISCreateGeneral (get_mpi_communicator(), 1, &petsc_row, &index_set);
     
 #if (PETSC_VERSION_MAJOR <= 2) && (PETSC_VERSION_MINOR <= 2)
@@ -234,6 +235,8 @@ namespace PETScWrappers
     
     AssertThrow (ierr == 0, ExcPETScError(ierr));
 
+    ISDestroy (index_set);
+    
     compress ();
   }
 
@@ -247,7 +250,6 @@ namespace PETScWrappers
 
                                      // now set all the entries of these rows
                                      // to zero
-    IS index_set;
 #if (PETSC_VERSION_MAJOR <= 2) && \
     ((PETSC_VERSION_MINOR < 2) ||  \
      ((PETSC_VERSION_MINOR == 2) && (PETSC_VERSION_SUBMINOR == 0)))
@@ -259,6 +261,7 @@ namespace PETScWrappers
                                      // call the functions. note that we have
                                      // to call them even if #rows is empty,
                                      // since this is a collective operation
+    IS index_set;
     ISCreateGeneral (get_mpi_communicator(), rows.size(),
                      &petsc_rows[0], &index_set);
     
@@ -272,6 +275,8 @@ namespace PETScWrappers
     
     AssertThrow (ierr == 0, ExcPETScError(ierr));
 
+    ISDestroy (index_set);
+    
     compress ();
   }
   

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.