[Lemon-user] Memory leaks in code using the LEMON library and CPLEX.

Spyros Vassilaras svasilaras at gmail.com
Mon Oct 24 10:33:23 CEST 2016


 Hello,

 I am experiencing some nasty memory leaks in my code which uses the LEMON
library (version 1.3.1) including the CPLEX API.
More specifically, the code implements a heuristic algorithm which performs
many iterations in order to converge to a good solution.
In each iteration a function is called which creates and solves an LP on a
network graph using CPLEX. After each iteration the memory footprint grows,
which means that even after exiting from the function, there are some
memory garbage that are not cleaned up.

The function receives the network graph and flow demands graph as
parameters (const Graph & network  --  const Digraph & demands) and creates
several variables on them such as:
Graph::ArcMap<IloRange> capacityConstraints(network, * new IloRange(env, 0
, 0));
Digraph::ArcMap<IloRange> flowConservationConstraints(demands);

The LP model is created with the commands:
IloEnv env;
IloModel model(env);
IloClpex cplex(model);

According to this post:
http://lemon.cs.elte.hu/pipermail/lemon-user/2013-March/000682.html , I was
expecting that all the variables created within the function should be
cleared up when exiting the function. But this is not the case.

Including the commands:
model.end();
cplex.clear();
before returning from the function reduced the amount of memory leak, but
it didn't solve the problem completely.
Any suggestions?

 Cheers,
 Spyros
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lemon.cs.elte.hu/pipermail/lemon-user/attachments/20161024/e56f0a36/attachment.html>


More information about the Lemon-user mailing list