[Clp] potential memory leak in CLP with CBC trunk

Kish Shen kisshen at cisco.com
Wed Feb 11 11:31:35 EST 2009


Hi,

I am now able to compile the latest trunk version of Cbc/Clp with gcc 
3.3 after my post about it yesterday. Thanks to Michael Hennebry and 
John Forrest for their help!

I ran valgrind with this latest download, and I am still seeing the same 
memory leak. I should have made clear in my previous message that I 
carefully checked that delete was done for all the pointers to the COIN 
solvers, in this case to OsiClpSolverInterface.

The only line of code I comment out between the two versions is the call 
to initialSolve()

	    lpd->lp->Solver->initialSolve();

where lpd->lp->Solver is a OsiClpSolverInterface *, which is allocated 
with a new:

     lp->Solver = new OsiXxxSolverInterface();

(OsiXxxSolverInterface is typdef'ed to OsiClpSolverInterface for the 
Cbc/Clp version here).

and Solver is deleted before the end of the program:

	delete lp->Solver;

With the initialSolve() line, I get the following leak summary,

==9960== LEAK SUMMARY:
==9960==    definitely lost: 0 bytes in 0 blocks.
==9960==      possibly lost: 0 bytes in 0 blocks.
==9960==    still reachable: 6,912 bytes in 3 blocks.
==9960==         suppressed: 0 bytes in 0 blocks.

but with the initialSolve() line commented out, I get:

==9993== LEAK SUMMARY:
==9993==    definitely lost: 0 bytes in 0 blocks.
==9993==      possibly lost: 0 bytes in 0 blocks.
==9993==    still reachable: 1,280 bytes in 1 blocks.
==9993==         suppressed: 0 bytes in 0 blocks.

I don't quite understand why these blocks are shown as reachable -- 
Solver, which is the only pointer in my code to the OsiClpSolver 
interface, is deleted (but I assume the delete method does not delete 
the 2 blocks that are allocated when initialSolve() is called). These 
blocks do show up as definitely lost in the real code I am using (rather 
than the simplified version I am compiling here).

Cheers,

Kish


-- 
This e-mail may contain confidential and privileged material for the
sole use of the intended recipient. Any review, use, distribution or
disclosure by others is strictly prohibited. If you are not the intended
recipient (or authorized to receive for the recipient), please contact
the sender by reply e-mail and delete all copies of this message.
Cisco Systems Limited (Company Number: 02558939), is registered in
England and Wales with its registered office at 1 Callaghan Square,
Cardiff, South Glamorgan CF10 5BT.




More information about the Clp mailing list