FRAMES NO FRAMES

Class IlcMemoryManagerI

Definition file: ilsolver/basic.h
Include file: <ilsolver/ilosolver.h>

An instance of this abstract implementation class is a memory manager. Its purpose is to delete automatically any memory used by a solver (an instance of IloSolver) but not allocated on the Solver heap.

In other words, if your application systematically allocates memory for a solver but does not use reversible allocation (by using IloSolver::getHeap) to do so, yet you want that memory to be deleted automatically, you should add a memory manager to the invoking solver to delete that allocated memory.

Use the member function IloSolver::addMemoryManager to add a memory manager to a solver. That member function will add the memory manager to the list of memory mangers associated with the invoking solver. Then, when the member function IloEnv::end is called for the invoking solver or when the solver re-extracts the model during synchronization, the virtual member function IlcMemoryManagerI::end will be called for all the memory managers on that list.

IlcMemoryManagerI is an abstract implementation class, so every time you define a subclass of this abstract class, you must redefine the virtual member function IlcMemoryManagerI::end to delete allocated memory appropriately.

Here is how we recommend that you use this class.

1. Define your own class.

 class MyMemoryManager : public IlcMemoryManagerI{
      void end();
    };
   void MyMemoryManager::end() {
  }
 

2. At run time, use your new class like this:

  s.addMemoryManager(new (s.getImpl()) MyMemoryManager());
 

See Also:

Constructor and Destructor Summary
public IlcMemoryManagerI()
Method Summary
protected virtual voidend()
Constructor and Destructor Detail

IlcMemoryManagerI

public IlcMemoryManagerI()

This constructor creates a memory manager.


Method Detail

end

protected virtual void end()

This member function automatically deletes memory not allocated on the Solver heap. It must be redefined appopriately whenever you derive a subclass of IlcMemoryManagerI.