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

Alpar Juttner alpar at cs.elte.hu
Mon Oct 24 11:15:22 CEST 2016


Hi,
> Graph::ArcMap capacityConstraints(network, * new
> IloRange(env, 0 , 0));
This line certainly looks quite badly. You allocate a temporary object
'IloRange' with 'new', but you do not 'delete' it.
Then and initialize the ArcMap by copying the temporary object for each
existing Arcs, this may or may not be what you want.
> 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.
You rightly expected - all the local variables are cleaned up on exit.
But the ones you allocated by 'new' are not local variables.
This is not LEMON specific, but how C++ works in general.
Regards,
Alpár



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


More information about the Lemon-user mailing list