← Back to team overview

dolfin team mailing list archive

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

 

On Sun, Feb 07, 2010 at 09:57:09AM -0000, Garth Wells wrote:
> I commented out all the code in jit_form (no leak) and added back lines
> one by one, checking the memory use as I went.  Looks like the culprit
> is
>
>     module = instant.import_module(jit_object, cache_dir=cache_dir)

I don't have time to look at it just now, but my suspicion is that
you are reusing a form that Instant should recognize as in the
in-memory cache, but it doesn't. Instead it compiles your form (or
loads it from disk cache) and then adds it to the expanding in-memory
cache.

This is probably related to computing correct signatures in
jitobject.py. If you send in the same form multiple times, they should
generate the same signature.

--
Anders

-- 
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