DG Kernel Documentation

Skip Navigation Links.
Skip Navigation LinksHome Page > DG Kernel Components > Advanced > Memory Management Search Documentation

Memory management

All objects, which expose interfaces, maintain internally an integer value called reference count. The reference count is incremented when an interface has been queried from the object or another object inside the software stores a reference to it. The reference count is decremented when an interface or reference is released. A reference-counted object is only deleted from memory during a release operation when its reference count becomes zero

In most situation the reference counting is maintained internally by DG Kernel and should not be modified. Sometimes, often when normal flow of execution was interrupted by an exception, the reference count can become incorrect and the object can be over-released and prematurely deleted, which often causes an exception.

On the other hand, reference count being incorrectly greater than the actual number of users, causes a memory leak. In either situation please report the problem

The reference counting can be checked using IGlobalAPI_KC.GetRefernceCount() method.