Originally posted by: UserCplex
Hello,
I have a model for which I instantiate all components as follows:
IloEnv env1;
IloModel model1(env1);
IloCplex cplex1(model1);
IloExpr objective1(env1);
IloObjective obj1(env1,objective1,IloObjective::Minimize);
IloRangeArray con1(env1);
IloNumVarArray x1(env1, 100, 0, IloInfinity, ILOFLOAT);
IloNumVarArray s1(env1, 100, 0, IloInfinity, ILOFLOAT);
IloNumArray xans1(env1, 100);
After doing what it is supposed to do, I free the memory associated with each of these objects as follows.
xans1.end();
s1.endElements(); s1.end();
x1.endElements(); x1.end();
con1.endElements(); con1.end();
obj1.end();
objective1.end();
cplex1.end();
model1.end();
env1.end();
However, the above code fails in the following line:
objective1.end()
The error is:
Unhandled exception at 0x007424d0 in xxx.exe: 0xC0000005: Access violation at location 0x00000000007424d0.
The specific code that seems to fail is in iloextractable.h:
void end() {
if ( _impl ){
_impl->end();
_impl = 0;//This line seems to be causing the problem.
}
}
If I comment out the specific .end() command as below:
//objective1.end(); Commenting out this line did not cause any problem
the error does not crop up.
Any ideas on what could be causing the exception?
Thanks.
#CPLEXOptimizers#DecisionOptimization