[Trilinos-Users] Visual Studio Issues

Roger Pawlowski rppawlo at sandia.gov
Tue Aug 31 10:20:30 MDT 2010


Hi Lukas,

The warning you are seeing is most likely due to a circular reference.  
This is case "c" in your warning message in your email.  See page 15 in 
the following document for more information on circular references:

http://www.cs.sandia.gov/~rabartl/RefCountPtrBeginnersGuideSAND.pdf

To eliminate a circular reference, you can either tag one of the rcps in 
the chain to be "weak" or you can manually break the circular dependency 
at the end of the run by setting one of the rpcs in the chain to null:

my_rcp_object = Teuchos::null;

Roger


On 08/31/2010 02:41 AM, Lukas Korous wrote:
> Hello,
>
> We are using NOX to solve a linear PDE. After assembling
> and solving the matrix problem, we get a Trilinos warning
> that an instance of our class NoxProblemInterface was not
> destructed properly. However, we have problems identifying
> where we are wrong. The RCP is declared in the header
> of a class NoxSolver
>
>        Teuchos::RCP<NoxProblemInterface>  interface;
>
> and the instance is created in the constructor of this
> object
>
>   interface = Teuchos::rcp(new NoxProblemInterface(problem));
>
> Is this obviously wrong? We believe that the RCP should take
> care of the destruction automatically, but evidently this is not the
> case. The message we are getting at the end of the program is
> copied below. Any hints are very much appreciated.
>
> ***
> *** Warning! The following Teuchos::RCPNode objects were created but have
> *** not been destroyed yet.  A memory checking tool may complain that these
> *** objects are not destroyed correctly.
> ***
> *** There can be many possible reasons that this might occur including:
> ***
> ***   a) The program called abort() or exit() before main() was finished.
> ***      All of the objects that would have been freed through destructors
> ***      are not freed but some compilers (e.g. GCC) will still call the
> ***      destructors on static objects (which is what causes this message
> ***      to be printed).
> ***
> ***   b) The program is using raw new/delete to manage some objects and
> ***      delete was not called correctly and the objects not deleted hold
> ***      other objects through reference-counted pointers.
> ***
> ***   c) This may be an indication that these objects may be involved in
> ***      a circular dependency of reference-counted managed objects.
> ***
>
>   0: RCPNode (map_key_void_ptr=0xc7452d8)
>       Information = {T=NoxProblemInterface,
> ConcreteT=NoxProblemInterface, p=0xc7452d8, has_ownership=1}
>       RCPNode address = 0xb40ee2c0
>       insertionNumber = 0
>
> NOTE: To debug issues, open a debugger, and set a break point in the
> function where
> the RCPNode object is first created to determine the context where the
> object first
> gets created.  Each RCPNode object is given a unique insertionNumber
> to allow setting
> breakpoints in the code.  For example, in GDB one can perform:
>
> 1) Open the debugger (GDB) and run the program again to get updated
> object addresses
>
> 2) Set a breakpoint in the RCPNode insertion routine when the desired
> RCPNode is first
> inserted.  In GDB, to break when the RCPNode with insertionNumber==3
> is added, do:
>
>   (gdb) b 'Teuchos::RCPNodeTracer::addNewRCPNode( [TAB] [ENTER]
>   (gdb) cond 1 insertionNumber==3 [ENTER]
>
> 3) Run the program in the debugger.  In GDB, do:
>
>   (gdb) run [ENTER]
>
> 4) Examine the call stack when the prgoram breaks in the function
> addNewRCPNode(...)
>
>
> Any help is very much appreciated,
> Kind Regards,
> Lukas Korous
>
> _______________________________________________
> Trilinos-Users mailing list
> Trilinos-Users at software.sandia.gov
> http://software.sandia.gov/mailman/listinfo/trilinos-users
>    



More information about the Trilinos-Users mailing list