Blueprint Help Send comments on this topic.
ClpMaxFreeBlockSize

Glossary Item Box

Description

CLIP provides a number of memory monitoring functions. These are useful for system monitoring and reporting.

When memory is allocated and deallocated the CLIP memory manager tracks the changes and maintains a list of the memory blocks in use and free. If two adjacent blocks are freed then these are combined into a single larger free block. However, when lots of memory is allocated and randomly deallocated (especially in small blocks), this can leaves holes in the memory map, where CLIP cannot recombine the free blocks. Thus although the system may be reporting that a large amount of memory is available, this is spread across the memory in small blocks. When this happens a subsequent memory request, which is smaller than the available memory, but larger than the biggest whole will fail.

To help prevent this CLIP maintains the size of the largest contiguous memory block. Any request smaller than this should succeed.

Generation

The ClpMaxFreeBlockSize function can be used to report on the largest contiguous block of free memory in the memory reserved by CLIP for its runtime heap.

Uns ClpMemAllocated();

Return

The function returns the memory block size in bytes.

Examples

Uns AppCct_MonitorMthdElem()::Process()
{
   ...


   const Uns memFreeMB = ClpMaxFreeBlockSize() / MB;
   const Uns memFreePC = 100 * memFreeMB / (gMEMORY / MB);

   ClpDiag( "Free Memory Block %dMB %d%%\n", memFreeMB, memFreePC ); 
  ...
}