[Trilinos-Users] Only using non-owning RCPs

Bart Janssens bart at bartjanssens.org
Thu Dec 22 10:46:42 EST 2016

Hi all,

I am taking the first small steps towards providing an interface from the
Julia language to Trilinos (starting with Tpetra). In Julia, memory
management happens through garbage collection. For interfacing with C++
code, this means that we can allocate using new and add a so-called
finalizer to Julia objects that gets called by the garbage collector when
the object is no longer referenced. In the case of a wrapped C++ object,
that finalizer would then call delete. In effect, this is as if the C++
object is already stored in a smart pointer.

To deal with the Teuchos RCP, I was thinking of using the following
- Objects allocated from the Julia interface just use the Julia finalizer
system, and are not stored in an RCP
- Whenever an RCP to such an object is needed, it is obtained using

The consequence of this is that structures like a Tpetra matrix would never
have an owning RCP refer to them. Is this approach compatible with the way
Trilinos works?

Kind regards,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://trilinos.org/pipermail/trilinos-users/attachments/20161222/ef38a63e/attachment.html>

More information about the Trilinos-Users mailing list