]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix a variety of memory leaks in the testsuite. 3521/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Thu, 10 Nov 2016 16:29:49 +0000 (09:29 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Thu, 10 Nov 2016 16:29:49 +0000 (09:29 -0700)
tests/bits/step-14.cc
tests/lac/constraints_block_01.cc
tests/multigrid/step-39-03.cc
tests/parameter_handler/parameter_handler_double_02.cc

index c24272fc0f982e27aa9d04c9b3e221ce9264c491..ba43cc56376b040d1a87b693ab068837af30e951 100644 (file)
@@ -1,6 +1,6 @@
 // ---------------------------------------------------------------------
 //
-// Copyright (C) 2005 - 2015 by the deal.II authors
+// Copyright (C) 2005 - 2016 by the deal.II authors
 //
 // This file is part of the deal.II library.
 //
@@ -2124,6 +2124,11 @@ int main ()
       deallog.threshold_double(1.e-10);
 
       const unsigned int dim = 2;
+
+      Data::SetUp<Data::Exercise_2_3<dim>,dim> setup;
+      const Point<dim> evaluation_point (0.75, 0.75);
+      DualFunctional::PointValueEvaluation<dim> eval(evaluation_point);
+
       Framework<dim>::ProblemDescription descriptor;
 
       descriptor.refinement_criterion
@@ -2132,11 +2137,8 @@ int main ()
       descriptor.primal_fe_degree = 1;
       descriptor.dual_fe_degree   = 2;
 
-      descriptor.data = new Data::SetUp<Data::Exercise_2_3<dim>,dim> ();
-
-      const Point<dim> evaluation_point (0.75, 0.75);
-      descriptor.dual_functional
-        = new DualFunctional::PointValueEvaluation<dim> (evaluation_point);
+      descriptor.data = &setup;
+      descriptor.dual_functional = &eval;
 
       Evaluation::PointValueEvaluation<dim>
       postprocessor1 (evaluation_point);
index 788eba7849e55d58aa85cca1c90ac88d9a0e655d..2d3891b39ed44e72540ceeacbd67b4a7bbd88ff6 100644 (file)
@@ -1,6 +1,6 @@
 // ---------------------------------------------------------------------
 //
-// Copyright (C) 2012 - 2015 by the deal.II authors
+// Copyright (C) 2012 - 2016 by the deal.II authors
 //
 // This file is part of the deal.II library.
 //
@@ -114,8 +114,8 @@ int main ()
   std::string fluid_fe_name = "FESystem[FE_Nothing()^2-FE_Nothing()^2-FE_Q(2)^2-FE_Q(1)-FE_Q(2)^2]";
 
   hp::FECollection<dim> fe_collection;
-  FiniteElement<dim> *solid_fe = FETools::get_fe_by_name<dim, dim>(solid_fe_name);
-  FiniteElement<dim> *fluid_fe = FETools::get_fe_by_name<dim, dim>(fluid_fe_name);
+  std_cxx11::unique_ptr<FiniteElement<dim> > solid_fe (FETools::get_fe_by_name<dim, dim>(solid_fe_name));
+  std_cxx11::unique_ptr<FiniteElement<dim> > fluid_fe (FETools::get_fe_by_name<dim, dim>(fluid_fe_name));
 
   deallog << "Solid FE Space: " << solid_fe->get_name() << std::endl;
   deallog << "Fluid/Mesh FE Space: " << fluid_fe->get_name() << std::endl;
index f082fb49dffa4f1cfd430118fcb149b741514c73..64428156b4a79ab48bc6cbc1cf91dc30d3441895 100644 (file)
@@ -675,6 +675,8 @@ namespace Step39
     data_out.build_patches ();
 
     data_out.write_gnuplot(gnuplot_output);
+
+    delete[] fn;
   }
 
   template <int dim>
index a42fedba5b192c4e5e80b79c3dccc608d0d603fa..1b60e2b141493b49117a3b1966099fdd16ae6a67 100644 (file)
@@ -1,6 +1,6 @@
 // ---------------------------------------------------------------------
 //
-// Copyright (C) 2003 - 2015 by the deal.II authors
+// Copyright (C) 2003 - 2016 by the deal.II authors
 //
 // This file is part of the deal.II library.
 //
@@ -33,6 +33,7 @@ void test(const std::string &desc)
       return;
     }
   deallog << c->description() << std::endl;
+  delete c;
 }
 
 

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.