Thanks for the precise bug report! While i forgot to update instant, hiding the real leak a while I finally nailed it. We needed to delete a void pointer to a shared_ptr<Foo*>. I do not think SWIG allocated any extra memory, we just forgot to reduce a ref count on a shared_ptr.
Johan On Friday 12 February 2010 16:39:59 Garth N. Wells wrote: > Johan Hake wrote: > > On Friday 12 February 2010 13:06:00 Garth N. Wells wrote: > >> Garth N. Wells wrote: > >>> I've tracked a leak in the Python interface down to the line: > >>> > >>> # Initialize base class > >>> cpp.Form.__init__(self, self._compiled_form, self.function_spaces, > >>> self.coefficients) > >>> > >>> on line 46 of form.py. If I do > >>> > >>> cpp.Form.__init__(self, self._compiled_form, self.function_spaces, > >>> []) > >>> > >>> then there is no observable leak. Any ideas? I checked dolfin::Form it > >>> it looks ok. I even commented out all code in the dolfin::Form > >>> constructor to be sure. > >> > >> Could the problem be in the SWIG wrapper for std::vector? The line > >> > >> res = SWIG_ConvertPtrAndOwn(py_item, &itemp, > >> $descriptor(dolfin::TYPE *), 0, &newmem); > >> > >> looks suspicious. Johan? > > > > I can have a look at it. I see that you have reported a bug. > > Yes, I dug deep enough that I could identify the problem precisely > enough for a bug report, but I couldn't fix it. > > Garth > > > Johan > > > >> Garth > >> > >>> Below is the script that I've been testing with. > >>> > >>> Garth > >>> > >>> > >>> from dolfin import * > >>> parameters["form_compiler"]["cpp_optimize"] = True > >>> parameters["form_compiler"]["optimize"] = True > >>> mesh = UnitSquare(16, 16) > >>> for t in xrange(20000): > >>> for level in xrange(100): > >>> V = FunctionSpace(mesh, "CG", 1) > >>> v = TestFunction(V) > >>> u = Function(V) > >>> u0 = Function(V) > >>> L = v*(u-u0)*dx > >>> b = assemble(L) > >>> print "----" > >>> > >>> > >>> > >>> _______________________________________________ > >>> Mailing list: https://launchpad.net/~dolfin > >>> Post to : dolfin@lists.launchpad.net > >>> Unsubscribe : https://launchpad.net/~dolfin > >>> More help : https://help.launchpad.net/ListHelp > >> > >> _______________________________________________ > >> Mailing list: https://launchpad.net/~dolfin > >> Post to : dolfin@lists.launchpad.net > >> Unsubscribe : https://launchpad.net/~dolfin > >> More help : https://help.launchpad.net/ListHelp > _______________________________________________ Mailing list: https://launchpad.net/~dolfin Post to : dolfin@lists.launchpad.net Unsubscribe : https://launchpad.net/~dolfin More help : https://help.launchpad.net/ListHelp