]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Fix a memory leak.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 28 Nov 2001 09:30:34 +0000 (09:30 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 28 Nov 2001 09:30:34 +0000 (09:30 +0000)
git-svn-id: https://svn.dealii.org/branches/Branch-3-2@5288 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/source/parameter_handler.cc
deal.II/deal.II/source/dofs/dof_handler.cc

index ecb65a158b2feab0b8a038fab959d74487582b10..05b007fef6a34a34f16a70d9cd4f9cbb7086b2e5 100644 (file)
@@ -1053,6 +1053,14 @@ ParameterHandler::memory_consumption () const
 
 ParameterHandler::Section::~Section () 
 {
+                                  // first release the memory pointed
+                                  // to by the second component of
+                                  // the pair, since we became owner
+                                  // of that memory through the
+                                  // clone() call
+  for (EntryType::iterator q=entries.begin(); q!=entries.end(); ++q)
+    delete q->second.second;
+                                  // then clear entire map
   entries.clear ();
 
   std::map<std::string, Section*>::iterator p;
index a66760356af25ee3d2d7375b7fa2dd118fa5b8f5..fe4818a0290f7329c45a308a5d776696dd39c9a0 100644 (file)
@@ -49,7 +49,10 @@ DoFHandler<dim>::DoFHandler (Triangulation<dim> &tria) :
 
 template <int dim>
 DoFHandler<dim>::~DoFHandler ()
-{};
+{
+                                  // release allocated memory
+  clear ();
+};
 
 
 #if deal_II_dimension == 1

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.