On Saturday 13 February 2010 13:08:05 Garth Wells wrote:
> Public bug reported:
>
> The below code leads to a memory leak (I see a leak over about 2MB over
> 90s). The leak is related to the Expression. If I comment out the call
> to
>
> eval(Array<double>&, const Array<double>&);
>
> from
>
> dolfin::GenericFunction::evaluate(double*, const double*, const
> ufc::cell) const
>
> I don't detect a leak.
I can confirm this bug. Not sure it is in the typemap, as it should also have
shown up if we moved f = MyExpression(degree=1) outside of the loop.
Johan
> ------
>
> 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 "----"
>
> ** Affects: dolfin
> Importance: Undecided
> Status: New
>
On Saturday 13 February 2010 13:08:05 Garth Wells wrote: double> &, const Array<double>&); :GenericFunctio n::evaluate( double* , const double*, const
> Public bug reported:
>
> The below code leads to a memory leak (I see a leak over about 2MB over
> 90s). The leak is related to the Expression. If I comment out the call
> to
>
> eval(Array<
>
> from
>
> dolfin:
> ufc::cell) const
>
> I don't detect a leak.
I can confirm this bug. Not sure it is in the typemap, as it should also have degree= 1) outside of the loop.
shown up if we moved f = MyExpression(
Johan
> ------ "form_compiler" ]["cpp_ optimize" ] = True "form_compiler" ]["optimize" ] = True Expression) : degree= 1)
>
> from dolfin import *
> parameters[
> parameters[
>
> class MyExpression(
> 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(
> L = v*(u-u0)*dx + v*f*ds
> b = assemble(L)
> print "----"
>
> ** Affects: dolfin
> Importance: Undecided
> Status: New
>