Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  memory leak in CPXfreeprob

    Posted 02/28/12 09:21 PM

    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, &copy_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


  • 2.  Re: memory leak in CPXfreeprob

    Posted 02/29/12 07:19 PM

    Originally posted by: amindehghanian


    By the way, I could install a trial version of Purify, and it shows a memory leakage in this part.

    Thanks,
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: memory leak in CPXfreeprob

    Posted 03/01/12 04:22 PM

    Originally posted by: SystemAdmin


    I don't see any obvious mistake in your code (except that you should initialize the copy_slp[2] = {NULL, NULL} to get correct error handling). Where does the "env_slp" come from?

    Tobias
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: memory leak in CPXfreeprob

    Posted 03/01/12 05:03 PM

    Originally posted by: amindehghanian


    Unfortunately, initializing copy_slp[2] did not solve the issue!

    env_slp is an environment which is defined out of my cutcallback function, then I pass it to my cutcallback function in order to solve several cut generation linear programmings in my cutcallback function.
    For sure, you remember I am implementing branch and cut:)

    Thanks,
    Amin
    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: memory leak in CPXfreeprob

    Posted 03/03/12 03:51 PM

    Originally posted by: amindehghanian


    Sorry,my bad!
    I found the source of issue, it is not related to functionality CPXfreeprob!

    Thanks again,
    Amin
    #CPLEXOptimizers
    #DecisionOptimization