From: wolf Date: Wed, 28 Nov 2001 09:30:34 +0000 (+0000) Subject: Fix a memory leak. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2e57d135936dcef65e4196d7ae0a6379993ba401;p=dealii-svn.git Fix a memory leak. git-svn-id: https://svn.dealii.org/branches/Branch-3-2@5288 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/base/source/parameter_handler.cc b/deal.II/base/source/parameter_handler.cc index ecb65a158b..05b007fef6 100644 --- a/deal.II/base/source/parameter_handler.cc +++ b/deal.II/base/source/parameter_handler.cc @@ -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::iterator p; diff --git a/deal.II/deal.II/source/dofs/dof_handler.cc b/deal.II/deal.II/source/dofs/dof_handler.cc index a66760356a..fe4818a029 100644 --- a/deal.II/deal.II/source/dofs/dof_handler.cc +++ b/deal.II/deal.II/source/dofs/dof_handler.cc @@ -49,7 +49,10 @@ DoFHandler::DoFHandler (Triangulation &tria) : template DoFHandler::~DoFHandler () -{}; +{ + // release allocated memory + clear (); +}; #if deal_II_dimension == 1