← Back to team overview

dolfin team mailing list archive

Re: [Bug 518241] [NEW] pydolfin-memory-leaks

 

The form data cache is now disabled. See if that help, and if you
notice and slowdowns in repeated assembly of forms.

The handling of form data caching has changed in UFL and FFC so it is
now explicit rather than hidden as part of the form class. This makes
for a cleaner design but it also leads to problems since the caching
is now not handled by the form and so does not go out of scope when a
form is destroyed. Let's see if this help and also if the caching is
really needed. If it turns out it is needed (I expect it is), we need
to find a new solution.

--
Anders


On Sun, Feb 07, 2010 at 01:03:10AM -0000, Garth Wells wrote:
> Public bug reported:
>
> There seem to be some nasty memory leaks in the Python interface. Some
> are bad enough that my solver crashes.
>
> 1. (see https://lists.launchpad.net/dolfin/msg00790.html)
>
> from dolfin import *
>
> mesh = UnitSquare(2, 2, "crossed")
>
> for i in xrange(5):
>     for j in xrange(500):
>         BDM = FunctionSpace(mesh, "Brezzi-Douglas-Marini", 1)
>     raw_input("Check memory use and press ENTER to continue")
>     print ". . . .", i
>
> 2.  The below problems leaks badly
>
> class MyNonlinearProblem(NonlinearProblem):
>     def __init__(self, a, L, ffc_parameters):
>         NonlinearProblem.__init__(self)
>         self.L = L
>         self.a = a
>         self.reset_sparsity = True
>         self.ffc_parameters = ffc_parameters
>     def F(self, b, x):
>         return
>     def J(self, A, x):
>         return
>
> for i in xrange(10):
>     # Create forms,
>     # Create MyNonlinearProblem
>     # Create NewtonSolver (modified to do nothing except call NewtonSolver::form,  which does nothing)
>     # Call solve
>
> It does  not leak if I have
>
> class MyNonlinearProblem(NonlinearProblem):
>     def __init__(self, a, L, ffc_parameters):
>         NonlinearProblem.__init__(self)
>         self.reset_sparsity = True
>         self.ffc_parameters = ffc_parameters
>     def F(self, b, x):
>         return
>     def J(self, A, x):
>         return
>
> ** Affects: dolfin
>      Importance: Critical
>          Status: Confirmed
>

-- 
pydolfin-memory-leaks
https://bugs.launchpad.net/bugs/518241
You received this bug notification because you are a member of DOLFIN
Team, which is subscribed to DOLFIN.

Status in DOLFIN: Confirmed

Bug description:
There seem to be some nasty memory leaks in the Python interface. Some are bad enough that my solver crashes.

1. (see https://lists.launchpad.net/dolfin/msg00790.html)

from dolfin import *

mesh = UnitSquare(2, 2, "crossed")

for i in xrange(5):
    for j in xrange(500):
        BDM = FunctionSpace(mesh, "Brezzi-Douglas-Marini", 1)
    raw_input("Check memory use and press ENTER to continue")
    print ". . . .", i

2.  The below problems leaks badly

class MyNonlinearProblem(NonlinearProblem):
    def __init__(self, a, L, ffc_parameters):
        NonlinearProblem.__init__(self)
        self.L = L
        self.a = a
        self.reset_sparsity = True
        self.ffc_parameters = ffc_parameters
    def F(self, b, x):
        return
    def J(self, A, x):
        return

for i in xrange(10):
    # Create forms, 
    # Create MyNonlinearProblem
    # Create NewtonSolver (modified to do nothing except call NewtonSolver::form,  which does nothing)
    # Call solve

It does  not leak if I have

class MyNonlinearProblem(NonlinearProblem):
    def __init__(self, a, L, ffc_parameters):
        NonlinearProblem.__init__(self)
        self.reset_sparsity = True
        self.ffc_parameters = ffc_parameters
    def F(self, b, x):
        return
    def J(self, A, x):
        return





References