[Clp] potential memory leak in CLP with CBC trunk
Stefan Vigerske
stefan at math.hu-berlin.de
Wed Feb 11 11:48:10 EST 2009
Hi,
valgrind should also tell you where the memory has been allocated that
has not been freed. Such an info would be very helpful, I think :-).
You would need to specify --leak-check=full --show-reachable=yes as
valgrind options.
Most info you get when the code is compiled in debug-mode.
Stefan
Kish Shen wrote:
> 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
>
>
--
Stefan Vigerske
Humboldt University Berlin, Numerical Mathematics
http://www.math.hu-berlin.de/~stefan
More information about the Clp
mailing list