dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #17568
Re: [Bug 521221] Re: Memory leak in std_vector_typemaps.i interface
Johan Hake wrote:
> On Saturday 13 February 2010 12:17:36 Garth N. Wells wrote:
>> Johan Hake wrote:
>>> On Saturday 13 February 2010 12:03:28 Garth N. Wells wrote:
>>>> Johan Hake wrote:
>>>>> On Saturday 13 February 2010 11:58:39 Garth N. Wells wrote:
>>>>>> Johan Hake wrote:
>>>>>>> On Saturday 13 February 2010 11:44:15 Garth N. Wells wrote:
>>>>>>>> Johan Hake wrote:
>>>>>>>>> Should be fixed now
>>>>>>>> Seems we may a leak in array_typemaps.i too. Can you take a look?
>>>>>>> Could you elaborate?
>>>>>> When I create an Expression with a eval function and use it in a form
>>>>>> inside a loop, I see the memory use increasing, just like for the
>>>>>> std::vector<Foo*> case. I can try to boil down an example. The example
>>>>>> I have now is full of commented code.
>>>>> Is it in a Python Expression?
>>>> Yes.
>>>>
>>>> class MyExpression(Expression):
>>>> def eval(self, values, x):
>>>> values[0] = 1.0 - x[0]
>>> I just exchanged a Function for an experssion of this type in your
>>> previous leak script and I cannot detect any leak.
>> After looking closer, it may not be in the SWIG interface. The problem
>> is when the Expression is declared inside the loop. The below code
>> leaks. It doesn't if I move 'f = MyExpression(degree=1)' outside of the
>> loop.
>>
>> Garth
>>
>>
>> from dolfin import *
>> parameters["form_compiler"]["cpp_optimize"] = True
>> parameters["form_compiler"]["optimize"] = True
>>
>> class MyExpression(Expression):
>> def eval(self, values, x):
>> if x[0] < DOLFIN_EPS:
>> values[0] = 1.0
>>
>> mesh = UnitSquare(32, 32)
>> for t in xrange(20000):
>> for level in xrange(100):
>> V = FunctionSpace(mesh, "CG", 1)
>> v = TestFunction(V)
>> u = Function(V)
>> u0 = Function(V)
>> f = MyExpression(degree=1)
>> L = v*(u-u0)*dx + v*f*ds
>> b = assemble(L)
>> print "----"
>
> This code does not produce top-detectable leak for me.
>
> FYI I do not have CGAL compiled into DOLFIN, but this should not cause any
> problems?
>
I'll try without CGAL.
Garth
> Johan
>
>>> Johan
>> _______________________________________________
>> Mailing list: https://launchpad.net/~dolfin
>> Post to : dolfin@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~dolfin
>> More help : https://help.launchpad.net/ListHelp
>>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dolfin
> Post to : dolfin@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dolfin
> More help : https://help.launchpad.net/ListHelp
References