[Osi] memory leaks in OSI/CLP
John J Forrest
jjforre at us.ibm.com
Thu Sep 17 02:27:05 EDT 2009
Thanks - patch will go in.
From: Renaud Lepere <Renaud.Lepere at alma.fr>
To: "osi at list.coin-or.org" <osi at list.coin-or.org>
Date: 09/15/2009 10:17 AM
Subject: [Osi] memory leaks in OSI/CLP
Sent by: osi-bounces at list.coin-or.org
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;
[attachment "leak.patch" deleted by John J Forrest/Watson/IBM] [attachment
"osi_16_9433435.inl.gz" deleted by John J Forrest/Watson/IBM] [attachment
"test_osi.cpp" deleted by John J Forrest/Watson/IBM]
_______________________________________________
Osi mailing list
Osi at list.coin-or.org
http://list.coin-or.org/mailman/listinfo/osi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/osi/attachments/20090917/c39e40a9/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graycol.gif
Type: image/gif
Size: 105 bytes
Desc: not available
URL: <http://list.coin-or.org/pipermail/osi/attachments/20090917/c39e40a9/attachment.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ecblank.gif
Type: image/gif
Size: 45 bytes
Desc: not available
URL: <http://list.coin-or.org/pipermail/osi/attachments/20090917/c39e40a9/attachment-0001.gif>
More information about the Osi
mailing list