| Overview | Group | Tree | Graph | Deprecated | Index | Concepts |
CP Optimizer provides an overloaded new operator. This
operator is overloaded to allocate data on the heap associated with the invoking
optimizer (an instance of IloCPEngine). The memory
used by objects allocated with this operator is automatically reclaimed in
these situations:
IloModel) or other extractable objects (instances of
IloExtractable or its subclasses) is re-extracted for an optimizer (an instance of IloCP);
end is called for the invoking optimizer.As a developer, you must not delete objects allocated with this operator because of this automatic freeing of memory.
In other words, the delete operator must not be used for
objects allocated on the heap associated with a optimizer.
The use of this overloaded new operator is not obligatory.
In fact, the use of the CP Optimizer heap is not mandatory. You determine whether CP Optimizer
uses the overloaded new operator or the conventional C++ new
operator when you define the ILC_NO_MEMORY_MANAGER environment variable. In particular, you can
allocate instances of CP Optimizer classes using the standard new operator or even
a special purpose allocator. However, some CP Optimizer objects contain other objects. For example,
CP Optimizer variables contain other objects (finite sets) that represent their domains. These
subobjects are allocated onto the optimizer allocation heap. Likewise, constraints are allocated
onto the optimizer allocation heap. Thus, they must not be deleted. CP Optimizer manages the corresponding
memory transparently.
To allocate an array of size objects of type T on the optimizer
allocation heap, you simply write this:
T* array = new (s.getHeap()) T [size];
When you do not want to use the optimizer allocation heap, you write this:
T* array = new T [size];
When you allocate an array in the way we recommend, it will automatically be de-allocated
in either of two situations: if backtracking occurs to a choice point set before this allocation;
if the member function end is called for the invoking optimizer.
new operator.
IBM ILOG Concert Technology offers this overloaded C++ new
operator. This operator is overloaded to allocate data on internal data
structures associated with an invoking environment (an instance of IloEnv). The memory used by objects allocated with
this overloaded operator is automatically reclaimed when you call the member
function IloEnv::end. As a developer, you
must not delete objects allocated with this operator because of
this automatic freeing of memory.
In other words, you must not use the delete
operator for objects allocated with this overloaded new
operator.
The use of this overloaded new operator is not obligatory in
Concert Technology applications. You will see examples of its use in the
user's manuals that accompany the IBM ILOG optimization products.