#73 Memory leak in QuadratureRuleContainer
Metadata
Property | Value |
---|---|
Reported by | Oliver Sander (oliver.sander@tu-dresden.de) |
Reported at | Jan 6, 2006 15:17 |
Type | Bug Report |
Version | Git (pre2.4) [autotools] |
Operating System | Unspecified / All |
Closed by | Markus Blatt (markus@dr-blatt.de) |
Closed at | May 11, 2006 13:47 |
Closed in version | Unknown |
Resolution | Fixed |
Comment | See my comment. |
Description
The simple program
#include <config.h> #include <dune/quadrature/quadraturerules.hh>
int main (int argc, char *argv[]) { const Dune::QuadratureRule<double, 2>& quad Dune::QuadratureRules<double, 2>::rule(Dune::cube, 2);
}
contains memory leaks, as can be witnessed when running it with
valgrind --leak-check=full quadleaktest
The reason is that the constructor of QuadratureRuleContainer creates new CubeQuadratureRules and SimplexQuadratureRules on the heap, but the destructor doesn't remove them.
Christian commented that it may be a good idea to have the different quadrature rules all be of the same c++ type and store them not on the heap but directly in a vector in the container class.