dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #22413
Re: [Bug 747273] [NEW] Python: LA objects are deleted when Dolfin object goes out of scope
Thanks for the bug report. There are no unhackish solution to this, but I have
attached the original tensor to the "down_casted" one. In this way we keep the
reference count up on the original tensor preventing garbage collection.
We do the same for the down_cast function.
Johan
On Friday April 1 2011 06:09:58 Joachim Haga wrote:
> Public bug reported:
>
> The following code:
> ------
> import PyTrilinos
> from dolfin import *
> parameters["linear_algebra_backend"] = "Epetra"
>
> mesh = UnitSquare(2,1)
> CG1 = FunctionSpace(mesh, "CG", 1)
> q, p = TestFunction(CG1), TrialFunction(CG1)
> A = assemble(q*p*dx)
>
> D = down_cast(A).mat()
> #del A
> print D
> ------
> fails when "del A" is uncommented. (with the petsc backend it always fails,
> but that's another problem).
>
> In cbc.block I work around this by creating a back-reference in the LA
> object to its container, but this should not be necessary given that
> shared_ptr is returned by mat().
>
> ** Affects: dolfin
> Importance: Undecided
> Status: New
--
You received this bug notification because you are a member of DOLFIN
Team, which is subscribed to DOLFIN.
https://bugs.launchpad.net/bugs/747273
Title:
Python: LA objects are deleted when Dolfin object goes out of scope
Status in DOLFIN:
New
Bug description:
The following code:
------
import PyTrilinos
from dolfin import *
parameters["linear_algebra_backend"] = "Epetra"
mesh = UnitSquare(2,1)
CG1 = FunctionSpace(mesh, "CG", 1)
q, p = TestFunction(CG1), TrialFunction(CG1)
A = assemble(q*p*dx)
D = down_cast(A).mat()
#del A
print D
------
fails when "del A" is uncommented. (with the petsc backend it always fails, but that's another problem).
In cbc.block I work around this by creating a back-reference in the LA
object to its container, but this should not be necessary given that
shared_ptr is returned by mat().
References