dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #06348
Re: Memory leak in IntersectionDetector
On Wed, Feb 27, 2008 at 08:09:12AM +0100, Dag Lindbo wrote:
> Kristen Kaasbjerg wrote:
> > Hi again
> >
> > One more thing I discovered is that the IntersectionDetector has
> > a memory leak (probably due to the undeleted GNode pointer).
> > This is relevant for the new eval function of the DiscreteFunction
> > class, which initiates an IntersectionDetector everytime the
> > DiscreteFunction is evaluated at a point. So many calls to the
> > eval function will eat up the memory!
>
> Why do you create a new intersection detector on each evaluation??? It
> cost a lot more computation to initialize the search tree than to do the
> search. That is, if your mesh is constant you save a lot of computation
> by only constructing the IntersectionDetector once.
>
> As for the memory leak, it is a known bug
> (http://www.fenics.org/cgi-bin/bugzilla/show_bug.cgi?id=26) and some
> work has been done to figure out what is going on.
Is it just that we don't delete the tree in the destructor:
IntersectionDetector::~IntersectionDetector()
{
// FIXME: Should delete tree here but need to include GNode properly.
// FIXME: (warning: invalid use of incomplete type 'struct _GNode')
//if (tree)
// delete (GNode*) tree;
}
I commented it out since I couldn't get it to compile. (Didn't have
time before the release to figure out what goes wrong.)
Note that bugs should be assigned to dolfin-dev@xxxxxxxxxx, not
dolfin@xxxxxxxxxx (which is an alias for /dev/null).
--
Anders
Follow ups
References