I install the latest version of cplex, and use it via its JAVA API.
To avoid the overhead of constructing cplex instance, I use cplex.clearmodel and then create the new model.
But when I use it to do linear programming thousands of times, the memory leak issue is very serious. It consumed more than 2GB RAM.
Does there exist any solution to alleviate the memory leak issue?
I’ve encountered this issue before when running my linear programs. You must CREATE exactly one object and continue to use only one reference to that object.
This issue is
Only call the above line once in your program. If the clearModel method isn’t working, clear all your constraints, clear your objective function, and clear your cuts individually and then reset your constraints and objective function, but do not create a new object. That is what is causing the memory leak. To solve your new model, use
I imagine your code looks something like this
Start your for or while loops after you create your instance of the IloCplex object. So, in contrast to the code above, do