[CoinUtils-tickets] [COIN-OR Common Utilities] #9: default OsiClp constructor, tries to allocate arrays of size 0

COIN-OR Common Utilities coin-trac at coin-or.org
Wed Oct 25 17:09:30 EDT 2006


#9: default OsiClp constructor, tries to allocate arrays of size 0
--------------------------+-------------------------------------------------
 Reporter:  mgalati       |       Owner:  somebody  
     Type:  defect        |      Status:  new       
 Priority:  minor         |   Milestone:  milestone1
Component:  component1    |     Version:  1.0       
 Keywords:  0 size array  |  
--------------------------+-------------------------------------------------
 Bug? Or bad design?

 When you use the default OsiClpSolverInterface constructor, it calls
 reset(), which allocates a CoinWarmStartBasis, but nint=0, so it tries to
 allocate arrays of size 0 for structuralStatus_ and artificialStatus_.

 {{{
 [W] MLK: Memory leak of 0 bytes from 1 block allocated in <>=(UINT)
 [TSPBcpsTMP.exe]
         Distribution of leaked blocks
                  0 bytes from 1 block of 0 bytes (0x0039e350)
         Allocation location
             new(UINT)
 [f:\vs70builds\3077\vc\crtbld\crt\src\newop.cpp:10]
             <>=(UINT)
 [f:\vs70builds\3077\vc\crtbld\crt\src\newaop.cpp:7]
             CoinWarmStartBasis::=(CoinWarmStartBasis const&)
 [c:\cygwin\home\magala\coin_new\coin-
 cbc1.1\coinutils\src\coinwarmstartbasis.cpp:94]
                     delete [] artificialStatus_;
                     // Round all so arrays multiple of 4
                     int nint = (numStructural_+15) >> 4;
              =>     structuralStatus_ = new char[4*nint];
                     memcpy (structuralStatus_, rhs.structuralStatus_,
                         (4*nint) * sizeof(char));
                     nint = (numArtificial_+15) >> 4;
             OsiClpSolverInterface::reset(void)
 [c:\cygwin\home\magala\coin_new\coin-
 cbc1.1\osi\src\osiclp\osiclpsolverinterface.cpp:3541]
                   rowActivity_ = NULL;
                   columnActivity_ = NULL;
                   integerInformation_ = NULL;
              =>   basis_ = CoinWarmStartBasis();
                   itlimOrig_=9999999;
                   lastAlgorithm_=0;
                   notOwned_=false;
             OsiClpSolverInterface::OsiClpSolverInterface(void)
 [c:\cygwin\home\magala\coin_new\coin-
 cbc1.1\osi\src\osiclp\osiclpsolverinterface.cpp:1889]
                   //printf("in default %x\n",this);
                   modelPtr_=NULL;
                   notOwned_=false;
              =>   reset();
                 }

 //-------------------------------------------------------------------
             main
 [c:\cygwin\home\magala\decomp\apps\tspbcpstmp\blismain.cpp:112]
                     try{
                     // Set up lp solver
                 #ifdef  COIN_HAS_CLP
              =>         OsiClpSolverInterface lpSolver;
                     lpSolver.getModelPtr()->setDualBound(1.0e10);
                     lpSolver.messageHandler()->setLogLevel(0);
                 #endif
             mainCRTStartup
 [f:\vs70builds\3077\vc\crtbld\crt\src\crt0.c:259]
 }}}

-- 
Ticket URL: <https://projects.coin-or.org/CoinUtils/ticket/9>
COIN-OR Common Utilities <http://projects.coin-or.org/CoinUtils>
Common data structures and linear algebra functions for COIN-OR projects



More information about the CoinUtils-tickets mailing list