Memory management

Provides recommendations to manage memory in Concert applications.

The recommended way to manage memory in Concert applications is to use the method IloEnv.end to clear all the memory currently in use.

If you need more control on the memory used by your OPL objects, IloOplModel objects offer the method end.

In the default case, after an OPL model instance has been ended, all its Concert objects that correspond to data elements are still available. After the method end, no objects remain. The following table summarizes the availability of Concert objects accessed through OPL elements.

Table 1. Availability of Concert objects
OPL Element Definition Available after end() Available after second postProcess()
external data elements read from a data source no yes
internal data elements initialized inside the .mod file no yes
dvar array solution value An array with values of decision variables for the current solution, available by calling the method asIntMap() or asNumMap() for a dvar array element no no
postprocessing All elements declared for postprocessing no no

When the postProcess method is called multiple times, as when processing intermediate feasible solutions, the second call ends the objects created for the first call.

See these two stock-cutting examples:

<Install_dir>\opl\examples\opl\cutstock\cutstock_main.mod

<Install_dir>\opl\examples\opl\cutstock\cutstock_int_main.mod

where <Install_dir> is your installation directory.