OpenClovis Logo

Functional Description
Heap Management

Description of Heap Management. More...

Description of Heap Management.

Computer programs use dynamic memory allocation to access memory area whose size is not known at compile time. The OpenClovis Heap Library provides the ability to optimize the performance and reduce fragmentation of free memory. Components and applications built on ASP can use this implementation for their dynamic memory requirements.

Applications can take ownership of a certain amount of memory using the clHeapAllocate(), clHeapCalloc() or clHeapRealloc() functions. The ownership of the memory chunk remains with the application until it is explicitly freed by invoking clHeapFree() API. After the memory is freed, it can be used for re-allocation.

Using the heap library, an application can specify any of the following to be used for dynamic memory allocation:

If the OpenClovis implementation is used, the heap library creates pools of memory chunks of one size. Thus different pools for different chunk sizes can be created within the same heap library. Each pool is created with an initial size that can later grow until an upper limit on the size of that pool or a process wide upper limit on dynamic memory is reached.

The pools grow in quantum of incrementPoolSize parameter. The size can be configured in the heap library during its initialization using clHeapLibInitialize() function. The library must be initialized before any call for dynamic memory allocation is made. When the process is terminated, the heap library must be finalized using clHeapLibFinalize() function. After finalizing the call, no dynamic memory allocation or de-allocation of memory should be attempted. The OpenClovis implementation also provides Notifications for conditions when the process limit crosses certain values. This enables the resource managers to take appropriate action.

OpenClovis implementation of the heap utility helps the application developer in detecting certain dynamic memory related issues. For example, detection of double free of a chunk, writing over the upper limit of a chunk (overrun), or writing below the lower limit of a chunk. These facilities are provided by setting the debug level of the library. It can also detect free memory chunk that is not allocated from the heap library or any attempt to free a partial chunk. An application can provide its own implementation of dynamic memory allocation using CL_HEAP_CUSTOM_MODE while invoking the clHeapLibInitialize() API. It can plug-in its own functions for allocation, re-allocation, and de-allocation of memory. All ASP components linked to this application can use the application registered functions for their own requirements.


Generated on Tue Jan 10 10:29:15 PST 2012 for OpenClovis SDK using Doxygen