symengine.py icon indicating copy to clipboard operation
symengine.py copied to clipboard

Teuchos warnings when exiting Python

Open certik opened this issue 6 years ago • 0 comments

Here is an example of the errors: https://travis-ci.org/symengine/symengine.py/jobs/281611351#L1697

*** 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=0x175c550)

       Information = {T=SymEngine::Symbol, ConcreteT=SymEngine::Symbol, p=0x175c550, has_ownership=1}

       RCPNode address = 0x17cd4f0

       insertionNumber = 66107

  1: RCPNode (map_key_void_ptr=0x14f1060)

       Information = {T=SymEngine::Symbol, ConcreteT=SymEngine::Symbol, p=0x14f1060, has_ownership=1}

       RCPNode address = 0x18f57b0

       insertionNumber = 66109

  2: RCPNode (map_key_void_ptr=0x195ead0)

       Information = {T=SymEngine::Symbol, ConcreteT=SymEngine::Symbol, p=0x195ead0, has_ownership=1}

       RCPNode address = 0x195eb50

       insertionNumber = 66110

  3: RCPNode (map_key_void_ptr=0x18e0510)

       Information = {T=SymEngine::Symbol, ConcreteT=SymEngine::Symbol, p=0x18e0510, has_ownership=1}

       RCPNode address = 0x18e0590

       insertionNumber = 66111

  4: RCPNode (map_key_void_ptr=0x203efb0)

       Information = {T=SymEngine::Symbol, ConcreteT=SymEngine::Symbol, p=0x203efb0, has_ownership=1}

       RCPNode address = 0x1a384f0

       insertionNumber = 66112

  5: RCPNode (map_key_void_ptr=0xf3faf0)

       Information = {T=SymEngine::Symbol, ConcreteT=SymEngine::Symbol, p=0xf3faf0, has_ownership=1}

       RCPNode address = 0x1a385b0

       insertionNumber = 66113

  6: RCPNode (map_key_void_ptr=0x2042520)

       Information = {T=SymEngine::Symbol, ConcreteT=SymEngine::Symbol, p=0x2042520, has_ownership=1}

       RCPNode address = 0x1fbea30

       insertionNumber = 66119

  7: RCPNode (map_key_void_ptr=0x1fbeaf0)

       Information = {T=SymEngine::Symbol, ConcreteT=SymEngine::Symbol, p=0x1fbeaf0, has_ownership=1}

       RCPNode address = 0x18f9190

       insertionNumber = 66120

  8: RCPNode (map_key_void_ptr=0x18f9210)

       Information = {T=SymEngine::Symbol, ConcreteT=SymEngine::Symbol, p=0x18f9210, has_ownership=1}

       RCPNode address = 0x18f3f50

       insertionNumber = 66121

  9: RCPNode (map_key_void_ptr=0x1fc5f70)

       Information = {T=SymEngine::Symbol, ConcreteT=SymEngine::Symbol, p=0x1fc5f70, has_ownership=1}

       RCPNode address = 0x1827080

       insertionNumber = 66125

 10: RCPNode (map_key_void_ptr=0x1827c00)

       Information = {T=SymEngine::Symbol, ConcreteT=SymEngine::Symbol, p=0x1827c00, has_ownership=1}

       RCPNode address = 0x1827c40

       insertionNumber = 66127

 11: RCPNode (map_key_void_ptr=0x17741d0)

       Information = {T=SymEngine::Symbol, ConcreteT=SymEngine::Symbol, p=0x17741d0, has_ownership=1}

       RCPNode address = 0x19f5280

       insertionNumber = 66130

 12: RCPNode (map_key_void_ptr=0x1774280)

       Information = {T=SymEngine::Symbol, ConcreteT=SymEngine::Symbol, p=0x1774280, has_ownership=1}

       RCPNode address = 0x1827110

       insertionNumber = 66131

 13: RCPNode (map_key_void_ptr=0x1a336a0)

       Information = {T=SymEngine::Symbol, ConcreteT=SymEngine::Symbol, p=0x1a336a0, has_ownership=1}

       RCPNode address = 0x1792ed0

       insertionNumber = 66141

 14: RCPNode (map_key_void_ptr=0x1792f20)

       Information = {T=SymEngine::Symbol, ConcreteT=SymEngine::Symbol, p=0x1792f20, has_ownership=1}

       RCPNode address = 0x1fbce10

       insertionNumber = 66142

 15: RCPNode (map_key_void_ptr=0x1fbce90)

       Information = {T=SymEngine::Symbol, ConcreteT=SymEngine::Symbol, p=0x1fbce90, has_ownership=1}

       RCPNode address = 0x19c0f80

       insertionNumber = 66143

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 program breaks in the function addNewRCPNode(...)

The 16 warnings are because of the 16 variables we create in test_var.py where we use var to inject symbols to the parent frame.

certik avatar Sep 30 '17 22:09 certik