← Back to team overview

dolfin team mailing list archive

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

 

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





Follow ups

References