dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #23263
[Bug 783857] Re: uBLASSparseMatrix data deleted when object goes out of scope
I don't think that we'll fix this. It's a very low-level interface which
needs to be used with care, and should be used only in exceptional
circumstances (it more intended for internal library usage). The objects
returned by the data function do not belong to DOLFIN, but to the
underlying solver object and the underlying solver object manages the
memory. If they were DOLFIN objects, we could use shared_ptr/array
objects to take care of destruction.
--
You received this bug notification because you are a member of DOLFIN
Team, which is subscribed to DOLFIN.
https://bugs.launchpad.net/bugs/783857
Title:
uBLASSparseMatrix data deleted when object goes out of scope
Status in DOLFIN:
New
Bug description:
This bug is similar to https://bugs.launchpad.net/dolfin/+bug/747273
The following code produces the output:
0.0333333333333
1.8218374251e-316
I.e. after deleting the uBLASSparseMatrix object the data members are
freed even though there are other references to the data.
from dolfin import *
mesh = UnitTetrahedron()
V = FunctionSpace(mesh, "Nedelec 1st kind H(curl)", 1)
u = TrialFunction(V)
v = TestFunction(V)
m = inner(v,u)*dx
M = uBLASSparseMatrix()
assemble(m, tensor=M)
row,col,data = M.data()
print data[0]
del M
import gc
gc.collect()
print data[0]
Follow ups
References