[Osi] memory leaks in OSI/CLP

Renaud Lepere Renaud.Lepere at alma.fr
Tue Sep 15 05:06:47 EDT 2009


Hello,

 I am using OSI/CLP to solve a lot of linear programs, some of them  
are impossible, but i have found some memory leaks on some problems.
I have instrumented my code to produce a standalone program that 
reproduce the leak, apparently the leak is within Clp code.
I have gone a bit further i think leak.patch should solve the 
problem. 

Renaud,


Roughly my code is something like :
 void test_xx() {
	OsiSolverInterface * solver(new OsiClpSolverInterface());
	solver->reset();

	solver->addCol(0, 0, 0, lb1, ub1, obj1);
	... 
	solver->addRow(...);

	solver->initialSolve();
      delete solver;
 }

The complete and standalone program is test_osi.cpp with includes
osi_16_9433435.inl, this file is a sort of log of the call i'm 
doing to osi (double values are encoded exactly using long long).

test_osi.cpp contains also a small memory leak detector. The output
of the program on 

Clp0024I Matrix will be packed to eliminate 307 small elements
Coin0506I Presolve 892 (-770) rows, 228 (-88) columns and 1784 (-1161) elements
Clp0009I 1 infeasibilities
Clp3003W Analysis indicates model infeasible or unbounded
Clp0006I 0  Obj 9726.95 Primal inf 203.146 (9)
Clp0006I 27  Obj 9738.14 Primal inf 168.766 (27)
Clp0001I Primal infeasible - objective value 9738.14
Clp0032I PrimalInfeasible objective 9738.139668 - 27 iterations time 0.082
Clp0006I 0  Obj 9738.14 Primal inf 168.766 (27)
Clp0006I 4  Obj 9738.14 Primal inf 185.375 (37)
Clp0001I Primal infeasible - objective value 9738.14
nbLeak: 43, nbAlloc: 21072

Using mmgr i located more precisely the leak, here is the call stack
>	test_osid.exe!ClpPresolve::gutsOfPresolvedModel(ClpSimplex * originalModel=0x0032b850, double feasibilityTolerance=1.0000000000000000e-008, bool keepIntegers=false, int numberPasses=5, bool dropNames=true, bool doRowObjective=false)  Ligne 1521 + 0xa octets	C++
 	test_osid.exe!ClpPresolve::presolvedModel(ClpSimplex & si={...}, double feasibilityTolerance=1.0000000000000000e-008, bool keepIntegers=false, int numberPasses=5, bool dropNames=true, bool doRowObjective=false)  Ligne 105	C++
 	test_osid.exe!ClpSimplex::initialSolve(ClpSolve & options={...})  Ligne 485 + 0x33 octets	C++
 	test_osid.exe!OsiClpSolverInterface::initialSolve()  Ligne 694	C++

Apparently the memory is lost when  model2 = this; line 906 in clpsolve.cpp 
i just added delete model2 line to fix the problem. 
                handler_->message(CLP_INFEASIBLE,messages_) <<CoinMessageEol;
->              delete model2; 
                model2 = this; 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: leak.patch
Type: application/octet-stream
Size: 359 bytes
Desc: leak.patch
URL: <http://list.coin-or.org/pipermail/osi/attachments/20090915/fcb6cdca/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: osi_16_9433435.inl.gz
Type: application/x-gzip
Size: 47791 bytes
Desc: osi_16_9433435.inl.gz
URL: <http://list.coin-or.org/pipermail/osi/attachments/20090915/fcb6cdca/attachment.gz>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test_osi.cpp
URL: <http://list.coin-or.org/pipermail/osi/attachments/20090915/fcb6cdca/attachment.ksh>


More information about the Osi mailing list