← Back to team overview

dolfin team mailing list archive

Re: Memory leak in IntersectionDetector

 

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).

Well... this is not the entire story. The leaves (pointers to bounding boxes) of the tree must be explicitly freed as well: gts_bb_tree_destroy(tree, 1). This still leaves some kbytes reachable (but not freed though).

After a bit of poking around, it seems like the glib slice allocator is not finalizing and freeing all its memory. Setting the environment variable G_SLICE=always-malloc reduces the problem so that valgrind reports "still reachable: 1,816 bytes" independent of the mesh size. Has anyone seen this kind of issue with GSList before? The Glib docs do not indicate a way to purge the memory held by the memory manager.

   Dag


References