]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix memory leaks tests. 3522/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Thu, 10 Nov 2016 23:16:52 +0000 (16:16 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Thu, 10 Nov 2016 23:29:52 +0000 (16:29 -0700)
tests/aniso/up_and_down.cc
tests/base/thread_validity_09.cc
tests/dofs/interpolate_based_on_material_id_01.cc
tests/fe/fe_q_bubbles.cc
tests/fe/fe_tools_01.cc
tests/fe/up_and_down.cc
tests/numerics/derivatives.cc

index d081e63fca996badfd09612e5f4ce73a0125f4fc..cf0639d6268fc7d23616432749cf471dbb644392 100644 (file)
@@ -1,6 +1,6 @@
 // ---------------------------------------------------------------------
 //
-// Copyright (C) 1998 - 2015 by the deal.II authors
+// Copyright (C) 1998 - 2016 by the deal.II authors
 //
 // This file is part of the deal.II library.
 //
@@ -232,6 +232,11 @@ void test ()
             check_element (tr, *fe_list[i]);
           }
     }
+
+
+  for (unsigned int i=0; i<sizeof(fe_list)/sizeof(fe_list[0]); ++i)
+    if (fe_list[i] != 0)
+      delete fe_list[i];
 }
 
 
index 9dc6460e91ed595ce780801b9810d35ac02d1289..0ba39f6d64b95c11b873b57e662d40b56cf39d9e 100644 (file)
@@ -1,6 +1,6 @@
 // ---------------------------------------------------------------------
 //
-// Copyright (C) 2008 - 2015 by the deal.II authors
+// Copyright (C) 2008 - 2016 by the deal.II authors
 //
 // This file is part of the deal.II library.
 //
@@ -73,4 +73,6 @@ int main()
 
   for (unsigned int i=0; i<sz; ++i)
     AssertThrow (p[i] == 0, ExcInternalError());
+
+  delete[] p;
 }
index 01061abf46f183f4a6b8adac80c6c7c9b005eb47..8715b1115a0d8d65567ba5cb7c9e7706589e3545 100644 (file)
@@ -1,6 +1,6 @@
 // ---------------------------------------------------------------------
 //
-// Copyright (C) 2006 - 2015 by the deal.II authors
+// Copyright (C) 2006 - 2016 by the deal.II authors
 //
 // This file is part of the deal.II library.
 //
@@ -101,6 +101,12 @@ void test ()
             AssertThrow (values[i] == cell->index() % 128, ExcInternalError());
         }
     }
+
+  for (typename std::map<types::material_id, const Function<dim>*>::iterator
+       p = functions.begin();
+       p != functions.end(); ++p)
+    delete p->second;
+
   deallog << "OK" << std::endl;
 }
 
index 77da76e868696857e336498ea470868507a836df..f3fac9af75278258bf7cc881c4e1fd471a2f5d2d 100644 (file)
@@ -1,7 +1,7 @@
 /* ---------------------------------------------------------------------
  * $Id$
  *
- * Copyright (C) 1999 - 2015 by the deal.II authors
+ * Copyright (C) 1999 - 2016 by the deal.II authors
  *
  * This file is part of the deal.II library.
  *
@@ -327,26 +327,38 @@ int main ()
     {
 //     {
 //       FiniteElement<2> *fe = new FE_Q<2>(degree);
-//       Step3<2> laplace_problem(fe, degree);
-//       laplace_problem.run();
+//       {
+//         Step3<2> laplace_problem(fe, degree);
+//         laplace_problem.run();
+//        }
+//        delete fe;
 //     }
 
       {
         FiniteElement<2> *fe = new FE_Q_Bubbles<2>(degree);
-        Step3<2> laplace_problem(fe, degree);
-        laplace_problem.run();
+        {
+          Step3<2> laplace_problem(fe, degree);
+          laplace_problem.run();
+        }
+        delete fe;
       }
 
 //     {
 //       FiniteElement<3> *fe = new FE_Q<3>(degree);
-//       Step3<3> laplace_problem(fe, degree);
-//       laplace_problem.run();
+//       {
+//         Step3<3> laplace_problem(fe, degree);
+//         laplace_problem.run();
+//        }
+//        delete fe;
 //     }
 
       {
         FiniteElement<3> *fe = new FE_Q_Bubbles<3>(degree);
-        Step3<3> laplace_problem(fe, degree);
-        laplace_problem.run();
+        {
+          Step3<3> laplace_problem(fe, degree);
+          laplace_problem.run();
+        }
+        delete fe;
       }
     }
   return 0;
index b5f9cd47bb8c0d8f6e1d1f3dd58fe2a1379c959c..56d002c0a795dec492de168d257d55cab9982c2f 100644 (file)
@@ -1,6 +1,6 @@
 // ---------------------------------------------------------------------
 //
-// Copyright (C) 2006 - 2015 by the deal.II authors
+// Copyright (C) 2006 - 2016 by the deal.II authors
 //
 // This file is part of the deal.II library.
 //
@@ -39,6 +39,8 @@ void test_fe(const char *name)
           << '\t' << fe->dofs_per_quad
           << '\t' << fe->dofs_per_hex
           << std::endl;
+
+  delete fe;
 }
 
 
index 6d8e3dda3f1dbdd5dd096713e2901c6ae286d788..61dc05487f142200036fddd9017f7d23a0e3134d 100644 (file)
@@ -1,6 +1,6 @@
 // ---------------------------------------------------------------------
 //
-// Copyright (C) 2013 - 2015 by the deal.II authors
+// Copyright (C) 2013 - 2016 by the deal.II authors
 //
 // This file is part of the deal.II library.
 //
@@ -236,6 +236,11 @@ void test ()
         deallog << dim << "d, uniform grid, fe #" << i;
         check_element (tr, *fe_list[i]);
       }
+
+
+  for (unsigned int i=0; i<sizeof(fe_list)/sizeof(fe_list[0]); ++i)
+    if (fe_list[i] != 0)
+      delete fe_list[i];
 }
 
 
index a596f7b15504a7e634e2847ff2fc59d56bc989f8..fe545aad5c2ac584aeafc5519d0ec642e2b7dea6 100644 (file)
@@ -1,6 +1,6 @@
 // ---------------------------------------------------------------------
 //
-// Copyright (C) 2013 - 2015 by the deal.II authors
+// Copyright (C) 2013 - 2016 by the deal.II authors
 //
 // This file is part of the deal.II library.
 //
@@ -200,6 +200,12 @@ void loop ()
         check (1, *maps[m], *elements[e], gauss);
 //      check (2, *maps[m], *elements[e], gauss);
       }
+
+  for (unsigned int m=0; m<maps.size(); ++m)
+    delete maps[m];
+
+  for (unsigned int e=0; e<elements.size(); ++e)
+    delete elements[e];
 }
 
 

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.