Originally posted by: amindehghanian
Hi,
In my branch and cut, I am assigning memory to 2 problems in my cut callback function by
'{CPXLPptr copy_slp[2];
for (int i=0;i<2;i++)
{
copy_slp[i] = CPXcloneprob (env_slp, slp[i], &status); // this creates a copy of slp problem
if ( status ) goto TERMINATE;
}
}'
At the end of my cut callback function, I free memory by:
'{
for(int i=0;i<2;i++)
if ( copy_slp[i] != NULL ) {
status = CPXfreeprob (env_slp, ©_slp[i]);
if ( status ) {
fprintf (stderr, "CPXfreeprob failed , error code %d.\n",
status);
}
}
}'
I am still struggling with installation of purify. So, I have not been to confirm this memory leak by purify yet though I am trying to do it.
On the other side, If I deactivate this part of my code, there will not be any memory issue.
Is there anything wrong with the way I am freeing memory?
Thanks,
Amin
#CPLEXOptimizers#DecisionOptimization