← Back to team overview

dolfin team mailing list archive

[Bug 702372] Re: BlockMatrix and deleted matrices

 

That is true. But we do not have too many objects that keep references
to La objects. We probably need to list these and either add a similar
hack or consider storing them using shared_ptrs, which they are not by
today. And again it will introduce a quite large revamp of the interface
to introduce that.

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

Title:
  BlockMatrix and deleted matrices

Status in DOLFIN:
  New

Bug description:
  The following code crashes, unless "del A" is commented out. I don't
  know the memory handling strategy in dolfin, (boost::shared_ptr is
  used in some places, but not consistently?) but attached is a patch
  which at least removes the crash by making private copies of the
  matrices (and vectors in BlockVectors).

  from dolfin import *

  mesh = UnitSquare(4, 4)
  V = FunctionSpace(mesh, "CG", 1)
  u,v = TrialFunction(V), TestFunction(V)

  a = u*v*dx

  AA = BlockMatrix(1,1)

  A = assemble(a)
  AA[0, 0] = A

  del A

  print AA[0,0]





References