← Back to team overview

dolfin team mailing list archive

Re: Leak in Python interface

 


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?

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@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dolfin
> More help   : https://help.launchpad.net/ListHelp





Follow ups

References