[Trilinos-Users] Teuchos::RCP behavior

Bartlett, Roscoe A. bartlettra at ornl.gov
Fri May 10 08:33:03 MDT 2013


Please carefully read section "5.11.6 Limitations of debug-mode runtime checking" in:

   http://www.ornl.gov/~8vt/TeuchosMemoryManagementSAND.pdf

If you construct your own objects on the stack there is nothing the Teuchos Memory Management classes can do to find invalid usage.

-Ross

From: trilinos-users-bounces at software.sandia.gov [mailto:trilinos-users-bounces at software.sandia.gov] On Behalf Of Villa Andrea (RSE)
Sent: Friday, May 10, 2013 9:16 AM
To: trilinos-users at software.sandia.gov
Subject: [Trilinos-Users] Teuchos::RCP behavior



I've implemented a very simple test code:

void assign(Teuchos::RCP<UInt> & P)
{
  UInt i = 4;
  P = Teuchos::rcpFromRef(i);
  cout << *P << endl;
}

int main(int argc, char *argv[])
{
  Teuchos::RCP<UInt> P;
  assign(P);

  cout << *P << endl;
  cout << "count: " << P.total_count() << endl;
}

I think that this is a non-correct usage of the RCP class, since a temporary reference is passed to P. In fact I get the following output:

4
0
count: 1

However even I have built Trilinos using
-D Teuchos_ENABLE_DEBUG:BOOL=ON \
-D Teuchos_ENABLE_DEBUG_RCP_NODE_TRACING:BOOL=ON \
no exception is thrown. Am I missing something?

Thank you very much.
Andrea Villa.

RSE SpA ha adottato il Modello Organizzativo ai sensi del D.Lgs.231/2001, in forza del quale l'assunzione di obbligazioni da parte della Società avviene con firma di un procuratore, munito di idonei poteri. RSE adopts a Compliance Programme under the Italian Law (D.Lgs.231/2001). According to this RSE Compliance Programme, any commitment of RSE is taken by the signature of one Representative granted by a proper Power of Attorney.

Le informazioni contenute in questo messaggio di posta elettronica sono riservate e confidenziali e ne e' vietata la diffusione in qualsiasi modo o forma. Qualora Lei non fosse la persona destinataria del presente messaggio, La invitiamo a non diffonderlo e ad eliminarlo, dandone gentilmente comunicazione al mittente. The information included in this e-mail and any attachments are confidential and may also be privileged. If you are not the correct recipient, you are kindly requested to notify the sender immediately, to cancel it and not to disclose the contents to any other person.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://software.sandia.gov/pipermail/trilinos-users/attachments/20130510/cff1afa2/attachment.html 


More information about the Trilinos-Users mailing list